summaryrefslogtreecommitdiff
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-10 19:07:33 +0200
commit6298100f2755c02d8f3f95db459d57feab16b004 (patch)
tree43d0490b2c1e13e546b2a9fca4c9a743396cef99
parent5a89c97f664a424b947a4021b431425274d461a0 (diff)
downloadefl-devs/bu5hm4n/dnd-fixes.tar.gz
elput: check for a special return valuedevs/bu5hm4n/dnd-fixes
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.
-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)
em->seat = eina_stringshare_add(seat);
ret = sd_pid_get_session(getpid(), &em->sid);
+
if (ret < 0)
{
- ERR("Could not get systemd session");
+ if (ret == -ENODATA || ret == -ENXIO)
+ ERR("Could not get systemd session, the pid is outside a session, check that you are running inside a logind-session.");
+ else
+ ERR("Could not get systemd session");
goto session_err;
}