summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2019-04-17 16:29:57 +0200
committerRichard Hughes <richard@hughsie.com>2019-04-28 02:10:26 -0400
commit8c956382760de35e577c1e01f73f26709a7a524f (patch)
treece9a89faac3be274c35925ec13e3ed86dccc9ca8
parentfd92df25b56fbc57291649468dc1fe95caebfafb (diff)
downloadcolord-8c956382760de35e577c1e01f73f26709a7a524f.tar.gz
trivial: Fix error checking for sd_pid_get_session and sd_session_get_seat
These functions can return a positive integer on success. Fix the conditions to only regard negative return values as errors. Fixes commit 6ffe2f6aae4bdc8331cab1fd9379ed8aef759749.
-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 514ae5c..ffcecb8 100644
--- a/src/cd-main.c
+++ b/src/cd-main.c
@@ -491,7 +491,7 @@ cd_main_get_seat_for_process (guint pid)
/* get session the process belongs to */
rc = sd_pid_get_session (pid, &sd_session);
- if (rc != 0) {
+ if (rc < 0) {
g_warning ("failed to get session [pid %u]: %s",
pid, strerror (-rc));
goto out;
@@ -499,7 +499,7 @@ cd_main_get_seat_for_process (guint pid)
/* get the seat the session is on */
rc = sd_session_get_seat (sd_session, &sd_seat);
- if (rc != 0) {
+ if (rc < 0) {
g_warning ("failed to get seat for session %s [pid %u]: %s",
sd_session, pid, strerror (-rc));
goto out;