summaryrefslogtreecommitdiffstats
path: root/src/shared/spawn-polkit-agent.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-12-29 18:13:38 +0100
committerLennart Poettering <lennart@poettering.net>2018-01-04 13:27:27 +0100
commit85afeae88c59ce3e6fb534facbcc6fc819f95a0f (patch)
treebc243b9cc0905dd5f878e5a2dc9fce76f4884800 /src/shared/spawn-polkit-agent.c
parenttree-wide: use EXIT_SUCCESS when comparing child process exit statuses (diff)
downloadsystemd-85afeae88c59ce3e6fb534facbcc6fc819f95a0f.tar.xz
systemd-85afeae88c59ce3e6fb534facbcc6fc819f95a0f.zip
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.
Diffstat (limited to 'src/shared/spawn-polkit-agent.c')
-rw-r--r--src/shared/spawn-polkit-agent.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shared/spawn-polkit-agent.c b/src/shared/spawn-polkit-agent.c
index 886248b9f9..3c93c79ceb 100644
--- a/src/shared/spawn-polkit-agent.c
+++ b/src/shared/spawn-polkit-agent.c
@@ -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;