Event though we've failed to open the backlight normally, we may still be
running under a suid-root xserver, so drop any elevated rights before
executing what we hope will be pkxec.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
switch ((b->pid = fork())) {
case 0:
+ if (setgid(getgid()) || setuid(getuid()))
+ _exit(127);
+
close(fds[1]);
- dup2(fds[0], 0);
+ if (dup2(fds[0], 0))
+ _exit(127);
close(fds[0]);
+
if (use_pkexec) {
execlp("pkexec", "pkexec",
LIBEXEC_PATH "/xf86-video-intel-backlight-helper",