summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher James Halse Rogers <raof@ubuntu.com>2015-02-19 11:56:05 +1100
committerChristopher James Halse Rogers <raof@ubuntu.com>2015-02-19 11:56:05 +1100
commit47295896713aeb42584d20ae0edd7a6075636c30 (patch)
tree8654e8391366f51d05731a2f2edfe8201a1c2788
parentd4c31cc698c1085fd5f9a83b614772ea0119a8c2 (diff)
downloadcolord-47295896713aeb42584d20ae0edd7a6075636c30.tar.gz
Fix reporting of logind errors.
The sd_* functions follow the kernel style of returning the negation of the relevant errno value on error. We therefore need to negate the return value before passing it to strerror().
-rw-r--r--src/cd-main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/cd-main.c b/src/cd-main.c
index fa71739..60b3205 100644
--- a/src/cd-main.c
+++ b/src/cd-main.c
@@ -536,7 +536,7 @@ cd_main_get_seat_for_process (guint pid)
rc = sd_pid_get_session (pid, &sd_session);
if (rc != 0) {
g_warning ("failed to get session [pid %i]: %s",
- pid, strerror (rc));
+ pid, strerror (-rc));
goto out;
}
@@ -544,7 +544,7 @@ cd_main_get_seat_for_process (guint pid)
rc = sd_session_get_seat (sd_session, &sd_seat);
if (rc != 0) {
g_warning ("failed to get seat for session %s [pid %i]: %s",
- sd_session, pid, strerror (rc));
+ sd_session, pid, strerror (-rc));
goto out;
}
seat = g_strdup (sd_seat);