From 25b04730781d2ea560696f1212f661765438ad28 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Wed, 22 Aug 2007 15:36:15 -0400 Subject: [PATCH] work when SELinux is disabled I've compiled with selinux and have it turned off. The attached patch stops the warnings for me. Richard. --- polkit-dbus/polkit-dbus.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/polkit-dbus/polkit-dbus.c b/polkit-dbus/polkit-dbus.c index 4c1f34b..ce6573c 100644 --- a/polkit-dbus/polkit-dbus.c +++ b/polkit-dbus/polkit-dbus.c @@ -604,12 +604,16 @@ polkit_caller_new_from_pid (DBusConnection *con, pid_t pid, DBusError *error) uid = statbuf.st_uid; #ifdef HAVE_SELINUX - if (getpidcon (pid, &secon) != 0) { - g_warning ("Cannot lookup SELinux context for pid %d: %s", pid, strerror (errno)); - goto out; - } - selinux_context = g_strdup (secon); - freecon (secon); + /* only get the context if we are enabled */ + selinux_context = NULL; + if (is_selinux_enabled () != 0) { + if (getpidcon (pid, &secon) != 0) { + g_warning ("Cannot lookup SELinux context for pid %d: %s", pid, strerror (errno)); + goto out; + } + selinux_context = g_strdup (secon); + freecon (secon); + } #else selinux_context = NULL; #endif -- 2.7.4