[gnome-settings-daemon] power: Don't pass SHELL in the backlight helper environment
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: Don't pass SHELL in the backlight helper environment
- Date: Tue, 12 May 2015 14:30:46 +0000 (UTC)
commit e9edfbb3a1341b85dd5d4e60549dd3d4e15fc4c3
Author: Rui Matos <tiagomatos gmail com>
Date: Mon May 4 18:04:38 2015 +0200
power: Don't pass SHELL in the backlight helper environment
Doing so causes pkexec to fail[0] if the current user's SHELL doesn't
exist in /etc/shells which happens for the gdm user in some
distributions.
Since we don't need this environment variable in the helper we can
work around that by just unsetting it.
[0] http://cgit.freedesktop.org/polkit/commit/?id=5a388b6ebb095de6dc7f315b651a84fc31d268d7
https://bugzilla.gnome.org/show_bug.cgi?id=748804
plugins/power/gpm-common.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/plugins/power/gpm-common.c b/plugins/power/gpm-common.c
index f8a2da5..e8769ca 100644
--- a/plugins/power/gpm-common.c
+++ b/plugins/power/gpm-common.c
@@ -392,6 +392,18 @@ backlight_available (GnomeRRScreen *rr_screen)
return TRUE;
}
+static gchar **
+get_backlight_helper_environ (void)
+{
+ static gchar **environ = NULL;
+
+ if (environ)
+ return environ;
+
+ environ = g_environ_unsetenv (g_get_environ (), "SHELL");
+ return environ;
+}
+
static gboolean
run_backlight_helper (enum BacklightHelperCommand command,
gchar *value,
@@ -413,7 +425,7 @@ run_backlight_helper (enum BacklightHelperCommand command,
return g_spawn_sync (NULL,
command == BACKLIGHT_HELPER_SET ? argv : &argv[1],
- NULL,
+ get_backlight_helper_environ (),
G_SPAWN_SEARCH_PATH,
NULL,
NULL,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]