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

Hans de Goede hdegoede at redhat.com
Mon Feb 17 13:16:52 CET 2014


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 at redhat.com>
---
 src/backlight.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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;
-- 
1.8.5.3




More information about the Intel-gfx mailing list