]> code.ossystems Code Review - openembedded-core.git/blob
3fdc7318d513ef6f96671b8df7e3a2b2deaac6ed
[openembedded-core.git] /
1 From 8fb8b406bab50c5ef8c5d4f743e3f13924bd5f73 Mon Sep 17 00:00:00 2001
2 From: David Zeuthen <davidz@redhat.com>
3 Date: Mon, 6 Feb 2012 11:26:06 -0500
4 Subject: [PATCH 2/2] PolkitUnixSession: Actually return TRUE if a session exists
5
6 Also, don't treat the integer returned by sd_session_get_uid() as a
7 boolean because that's just confusing.
8
9 Signed-off-by: David Zeuthen <davidz@redhat.com>
10 ---
11
12 Upstream-status: Accepted
13
14  src/polkit/polkitunixsession-systemd.c |   12 +++++-------
15  1 files changed, 5 insertions(+), 7 deletions(-)
16
17 diff --git a/src/polkit/polkitunixsession-systemd.c b/src/polkit/polkitunixsession-systemd.c
18 index 94a7ee4..8a8bf65 100644
19 --- a/src/polkit/polkitunixsession-systemd.c
20 +++ b/src/polkit/polkitunixsession-systemd.c
21 @@ -361,17 +361,15 @@ polkit_unix_session_to_string (PolkitSubject *subject)
22  
23  static gboolean
24  polkit_unix_session_exists_sync (PolkitSubject   *subject,
25 -                                    GCancellable    *cancellable,
26 -                                    GError         **error)
27 +                                 GCancellable    *cancellable,
28 +                                 GError         **error)
29  {
30    PolkitUnixSession *session = POLKIT_UNIX_SESSION (subject);
31 -  gboolean ret;
32 +  gboolean ret = FALSE;
33    uid_t uid;
34  
35 -  ret = FALSE;
36 -
37 -  if (!sd_session_get_uid (session->session_id, &uid))
38 -    ret = FALSE;
39 +  if (sd_session_get_uid (session->session_id, &uid) == 0)
40 +    ret = TRUE;
41  
42    return ret;
43  }
44 -- 
45 1.7.2.5
46