summaryrefslogtreecommitdiff
path: root/src/lib/elput
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-07-10 19:07:33 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2016-07-11 11:02:52 +0200
commit38554b652a14f5a089a3384e61f2fa6d05ceebcb (patch)
tree2aee132eeaf2bee2812fadee03650870097e8ff5 /src/lib/elput
parentf0325fc190cc6df02457581f0fc7c7a05185ffed (diff)
elput: check for a special return value
sd_pid_get_session returns ENODATA or ENXIO if it was unable to fetch the session data for the given pid, reason for that is mostly that the pid is not running is a session. Adding this as the error value can help the user debugging the problem without the need of gdb´ing into the function and checking the return value.
Diffstat (limited to 'src/lib/elput')
-rw-r--r--src/lib/elput/elput_logind.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/elput/elput_logind.c b/src/lib/elput/elput_logind.c
index 206f6e8337..5d97a020cd 100644
--- a/src/lib/elput/elput_logind.c
+++ b/src/lib/elput/elput_logind.c
@@ -420,9 +420,13 @@ _logind_connect(Elput_Manager **manager, const char *seat, unsigned int tty)
420 em->seat = eina_stringshare_add(seat); 420 em->seat = eina_stringshare_add(seat);
421 421
422 ret = sd_pid_get_session(getpid(), &em->sid); 422 ret = sd_pid_get_session(getpid(), &em->sid);
423
423 if (ret < 0) 424 if (ret < 0)
424 { 425 {
425 ERR("Could not get systemd session"); 426 if (ret == -ENODATA || ret == -ENXIO)
427 ERR("Could not get systemd session, the pid is outside a session, check that you are running inside a logind-session.");
428 else
429 ERR("Could not get systemd session");
426 goto session_err; 430 goto session_err;
427 } 431 }
428 432