From: Hans de Goede Subject: [PATCH 2/4] backlight: Use System instead of system when checking for pkexec Date: Mon, 17 Feb 2014 13:16:52 +0100 Message-ID: <1392639414-3909-3-git-send-email-hdegoede@redhat.com> References: <1392639414-3909-1-git-send-email-hdegoede@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by gabe.freedesktop.org (Postfix) with ESMTP id 549F4FA57C for ; Mon, 17 Feb 2014 04:17:00 -0800 (PST) Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1HCGxZu025144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 17 Feb 2014 07:17:00 -0500 In-Reply-To: <1392639414-3909-1-git-send-email-hdegoede@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org Cc: peter.hutterer@redhat.com List-Id: intel-gfx@lists.freedesktop.org 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 --- 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 #include #include +#include #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