From patchwork Mon Feb 17 12:16:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 3662871 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A1DF49F2EC for ; Mon, 17 Feb 2014 12:17:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D6D1420155 for ; Mon, 17 Feb 2014 12:17:04 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1D7592010E for ; Mon, 17 Feb 2014 12:17:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 12E96FA70A; Mon, 17 Feb 2014 04:17:02 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org 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 Received: from shalem.localdomain.com (vpn1-7-24.ams2.redhat.com [10.36.7.24]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1HCGu7g010532; Mon, 17 Feb 2014 07:16:58 -0500 From: Hans de Goede To: intel-gfx@lists.freedesktop.org Date: Mon, 17 Feb 2014 13:16:52 +0100 Message-Id: <1392639414-3909-3-git-send-email-hdegoede@redhat.com> In-Reply-To: <1392639414-3909-1-git-send-email-hdegoede@redhat.com> References: <1392639414-3909-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Cc: peter.hutterer@redhat.com Subject: [Intel-gfx] [PATCH 2/4] backlight: Use System instead of system when checking for pkexec X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;