summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/polkit/polkit-0.104/0002-PolkitUnixSession-Actually-return-TRUE-if-a-session-.patch
blob: 49f8ce2a062ae1ba32d28622e0c9cf424adc559f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From 8fb8b406bab50c5ef8c5d4f743e3f13924bd5f73 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>
---

Upstream-Status: Accepted

 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.2.5