Sophie

Sophie

distrib > Fedora > 17 > i386 > by-pkgid > e9ea434bd6c89c9080e1e439e4109d5a > files > 3

polkit-0.104-7.fc17.src.rpm

From 414f38ee69155eef8badd6f938953c98ce0c1e76 Mon Sep 17 00:00:00 2001
From: David Zeuthen <davidz@redhat.com>
Date: Mon, 6 Feb 2012 11:26:06 -0500
Subject: [PATCH 2/2] PolkitUnixSession: Actually return TRUE if a session
 exists

Also, don't treat the integer returned by sd_session_get_uid() as a
boolean because that's just confusing.

Signed-off-by: David Zeuthen <davidz@redhat.com>
---
 src/polkit/polkitunixsession-systemd.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/polkit/polkitunixsession-systemd.c b/src/polkit/polkitunixsession-systemd.c
index 94a7ee4..8a8bf65 100644
--- a/src/polkit/polkitunixsession-systemd.c
+++ b/src/polkit/polkitunixsession-systemd.c
@@ -361,17 +361,15 @@ polkit_unix_session_to_string (PolkitSubject *subject)
 
 static gboolean
 polkit_unix_session_exists_sync (PolkitSubject   *subject,
-                                    GCancellable    *cancellable,
-                                    GError         **error)
+                                 GCancellable    *cancellable,
+                                 GError         **error)
 {
   PolkitUnixSession *session = POLKIT_UNIX_SESSION (subject);
-  gboolean ret;
+  gboolean ret = FALSE;
   uid_t uid;
 
-  ret = FALSE;
-
-  if (!sd_session_get_uid (session->session_id, &uid))
-    ret = FALSE;
+  if (sd_session_get_uid (session->session_id, &uid) == 0)
+    ret = TRUE;
 
   return ret;
 }
-- 
1.7.8.4