summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2012-02-06 11:26:06 -0500
committerDavid Zeuthen <davidz@redhat.com>2012-02-06 11:34:09 -0500
commit8fb8b406bab50c5ef8c5d4f743e3f13924bd5f73 (patch)
tree97bf8d35f23f76b838d8b884fe03a180ea958ad2 /src
parentc46d2d13eac240d2a609b2dd8fc617ea18a78bfa (diff)
downloadpolkit-8fb8b406bab50c5ef8c5d4f743e3f13924bd5f73.tar.gz
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>
Diffstat (limited to 'src')
-rw-r--r--src/polkit/polkitunixsession-systemd.c12
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;
}