diff mbox

[2/4] backlight: Use System instead of system when checking for pkexec

Message ID 1392639414-3909-3-git-send-email-hdegoede@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hans de Goede Feb. 17, 2014, 12:16 p.m. UTC
Event 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>
---
 src/backlight.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/src/backlight.c b/src/backlight.c
index 0e63ba5..518d756 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;