pager,agent: insist that we are called from the main thread
We maintain static process-wide variables in these subsystems without locking, hence let's refuse operation unless we are called from the main thread (which we do anyway) just as a safety precaution.
This commit is contained in:
parent
b4a343112e
commit
85afeae88c
|
@ -73,6 +73,9 @@ int pager_open(bool no_pager, bool jump_to_end) {
|
|||
if (terminal_is_dumb())
|
||||
return 0;
|
||||
|
||||
if (!is_main_thread())
|
||||
return -EPERM;
|
||||
|
||||
pager = getenv("SYSTEMD_PAGER");
|
||||
if (!pager)
|
||||
pager = getenv("PAGER");
|
||||
|
|
|
@ -40,6 +40,9 @@ int ask_password_agent_open(void) {
|
|||
if (!isatty(STDIN_FILENO))
|
||||
return 0;
|
||||
|
||||
if (!is_main_thread())
|
||||
return -EPERM;
|
||||
|
||||
r = fork_agent("(sd-askpwagent)",
|
||||
NULL, 0,
|
||||
&agent_pid,
|
||||
|
|
|
@ -52,6 +52,9 @@ int polkit_agent_open(void) {
|
|||
if (!isatty(STDIN_FILENO))
|
||||
return 0;
|
||||
|
||||
if (!is_main_thread())
|
||||
return -EPERM;
|
||||
|
||||
if (pipe2(pipe_fd, 0) < 0)
|
||||
return -errno;
|
||||
|
||||
|
|
Loading…
Reference in a new issue