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.
This commit is contained in:
Marcel Hollerbach 2016-07-10 19:07:33 +02:00
parent f0325fc190
commit 38554b652a
1 changed files with 5 additions and 1 deletions

View File

@ -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;
}