forked from enlightenment/efl
elput: Fix crash whem sd_session_get_seat fails
If systemd fails to give us a valid session id, then any further calls to get a seat from that session are going to fail. As such, check for a valid seat return from systemd before calling any systemd functions which require session id. Fixes T3785 @fix Signed-off-by: Chris Michael <cpmichael@osg.samsung.com>
This commit is contained in:
parent
b1f62061b9
commit
180e64653d
|
@ -406,7 +406,7 @@ _logind_connect(Elput_Manager **manager, const char *seat, unsigned int tty)
|
||||||
{
|
{
|
||||||
Elput_Manager *em;
|
Elput_Manager *em;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *s;
|
char *s = NULL;
|
||||||
|
|
||||||
em = calloc(1, sizeof(Elput_Manager));
|
em = calloc(1, sizeof(Elput_Manager));
|
||||||
if (!em) return EINA_FALSE;
|
if (!em) return EINA_FALSE;
|
||||||
|
@ -421,6 +421,8 @@ _logind_connect(Elput_Manager **manager, const char *seat, unsigned int tty)
|
||||||
goto session_err;
|
goto session_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!em->sid) goto session_err;
|
||||||
|
|
||||||
ret = sd_session_get_seat(em->sid, &s);
|
ret = sd_session_get_seat(em->sid, &s);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
|
@ -428,7 +430,7 @@ _logind_connect(Elput_Manager **manager, const char *seat, unsigned int tty)
|
||||||
free(s);
|
free(s);
|
||||||
goto seat_err;
|
goto seat_err;
|
||||||
}
|
}
|
||||||
else if ((seat) && (strcmp(seat, s)))
|
else if ((seat) && (s) && (strcmp(seat, s)))
|
||||||
{
|
{
|
||||||
ERR("Seat '%s' differs from session seat '%s'", seat, s);
|
ERR("Seat '%s' differs from session seat '%s'", seat, s);
|
||||||
free(s);
|
free(s);
|
||||||
|
|
Loading…
Reference in New Issue