summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2014-02-17 13:16:52 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-02-17 18:38:45 +0000
commit27a9dc4ce8fa3ba56f68e04d11a6272348772039 (patch)
treec4b5fb09acc4680d0af3f6781c77318a02b909ec
parent06066b7269b5ccf502c27466ad0434adfd9e3866 (diff)
backlight: Use System instead of system when checking for pkexec
Even though we've failed to open the backlight normally, we may still be running under a suid-root xserver, so use the servers build in System instead of system so as to properly drop root rights. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--src/backlight.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backlight.c b/src/backlight.c
index 728cddad..0501070c 100644
--- a/src/backlight.c
+++ b/src/backlight.c
@@ -41,6 +41,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <dirent.h>
+#include <xf86.h>
#include "backlight.h"
#include "fd.h"
@@ -283,7 +284,7 @@ static int __backlight_helper_init(struct backlight *b, char *iface)
return 0;
if ((st.st_mode & (S_IFREG | S_ISUID | S_IXUSR)) != (S_IFREG | S_ISUID | S_IXUSR)) {
- if (system("pkexec --version"))
+ if (System("pkexec --version"))
return 0;
use_pkexec = 1;