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.
if (terminal_is_dumb())
return 0;
+ if (!is_main_thread())
+ return -EPERM;
+
pager = getenv("SYSTEMD_PAGER");
if (!pager)
pager = getenv("PAGER");
if (!isatty(STDIN_FILENO))
return 0;
+ if (!is_main_thread())
+ return -EPERM;
+
r = fork_agent("(sd-askpwagent)",
NULL, 0,
&agent_pid,
if (!isatty(STDIN_FILENO))
return 0;
+ if (!is_main_thread())
+ return -EPERM;
+
if (pipe2(pipe_fd, 0) < 0)
return -errno;