]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/shared/spawn-polkit-agent.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / shared / spawn-polkit-agent.c
index ada4bdb17e284dfcc98e40d4a71bda0a76ae934a..423069fb0ec2ccf7a877195a85c23d4367bd8c2a 100644 (file)
@@ -1,5 +1,4 @@
-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd.
 
@@ -35,7 +34,7 @@
 #include "time-util.h"
 #include "util.h"
 
-#ifdef ENABLE_POLKIT
+#if ENABLE_POLKIT
 static pid_t agent_pid = 0;
 
 int polkit_agent_open(void) {
@@ -46,6 +45,10 @@ int polkit_agent_open(void) {
         if (agent_pid > 0)
                 return 0;
 
+        /* Clients that run as root don't need to activate/query polkit */
+        if (geteuid() == 0)
+                return 0;
+
         /* We check STDIN here, not STDOUT, since this is about input,
          * not output */
         if (!isatty(STDIN_FILENO))