X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-user.c;h=6720899def35326046503295c152f49b2fab27ad;hb=f5765a8e9044f87b6acbf9c4fbf4f63553ff0276;hp=2f62e34f6319a68cbdd528191bcdba1bbbcc7893;hpb=3cc73f4d1fc9e1b41ab97a884ac263f21e34eb2a;p=elogind.git diff --git a/src/login/logind-user.c b/src/login/logind-user.c index 2f62e34f6..6720899de 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -320,7 +320,7 @@ static int user_mkdir_runtime_path(User *u) { } else p = u->runtime_path; - if (path_is_mount_point(p, false) <= 0) { + if (path_is_mount_point(p, 0) <= 0) { _cleanup_free_ char *t = NULL; (void) mkdir(p, 0700); @@ -619,7 +619,7 @@ int user_finalize(User *u) { int user_get_idle_hint(User *u, dual_timestamp *t) { Session *s; bool idle_hint = true; - dual_timestamp ts = { 0, 0 }; + dual_timestamp ts = DUAL_TIMESTAMP_NULL; assert(u); @@ -738,8 +738,7 @@ int user_kill(User *u, int signo) { return manager_kill_unit(u->manager, u->slice, KILL_ALL, signo, NULL); } -static bool -elect_display_filter(Session *s) { +static bool elect_display_filter(Session *s) { /* Return true if the session is a candidate for the user’s ‘primary * session’ or ‘display’. */ assert(s); @@ -747,8 +746,7 @@ elect_display_filter(Session *s) { return (s->class == SESSION_USER && !s->stopping); } -static int -elect_display_compare(Session *s1, Session *s2) { +static int elect_display_compare(Session *s1, Session *s2) { /* Indexed by SessionType. Lower numbers mean more preferred. */ const int type_ranks[_SESSION_TYPE_MAX] = { [SESSION_UNSPECIFIED] = 0, @@ -765,6 +763,9 @@ elect_display_compare(Session *s1, Session *s2) { * is preferred. * * s1 or s2 may be NULL. */ + if (!s1 && !s2) + return 0; + if ((s1 == NULL) != (s2 == NULL)) return (s1 == NULL) - (s2 == NULL);