diff options
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/logind-dbus.c | 36 | ||||
-rw-r--r-- | src/login/logind-session.c | 5 | ||||
-rw-r--r-- | src/login/logind.c | 4 |
3 files changed, 19 insertions, 26 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 1647bb293a..992a9f5b4a 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -2511,7 +2511,7 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err r = sd_bus_message_read(message, "uoss", &id, &path, &unit, &result); if (r < 0) { bus_log_parse_error(r); - return r; + return 0; } if (m->action_job && streq(m->action_job, path)) { @@ -2520,8 +2520,7 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err /* Tell people that they now may take a lock again */ send_prepare_for(m, m->action_what, false); - free(m->action_job); - m->action_job = NULL; + m->action_job = mfree(m->action_job); m->action_unit = NULL; m->action_what = 0; return 0; @@ -2530,10 +2529,8 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err session = hashmap_get(m->session_units, unit); if (session) { - if (streq_ptr(path, session->scope_job)) { - free(session->scope_job); - session->scope_job = NULL; - } + if (streq_ptr(path, session->scope_job)) + session->scope_job = mfree(session->scope_job); session_jobs_reply(session, unit, result); @@ -2545,19 +2542,14 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err user = hashmap_get(m->user_units, unit); if (user) { - if (streq_ptr(path, user->service_job)) { - free(user->service_job); - user->service_job = NULL; - } + if (streq_ptr(path, user->service_job)) + user->service_job = mfree(user->service_job); - if (streq_ptr(path, user->slice_job)) { - free(user->slice_job); - user->slice_job = NULL; - } + if (streq_ptr(path, user->slice_job)) + user->slice_job = mfree(user->slice_job); - LIST_FOREACH(sessions_by_user, session, user->sessions) { + LIST_FOREACH(sessions_by_user, session, user->sessions) session_jobs_reply(session, unit, result); - } user_save(user); user_add_to_gc_queue(user); @@ -2579,7 +2571,7 @@ int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *er r = sd_bus_message_read(message, "so", &unit, &path); if (r < 0) { bus_log_parse_error(r); - return r; + return 0; } session = hashmap_get(m->session_units, unit); @@ -2611,8 +2603,10 @@ int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_err r = unit_name_from_dbus_path(path, &unit); if (r == -EINVAL) /* not a unit */ return 0; - if (r < 0) - return r; + if (r < 0) { + log_oom(); + return 0; + } session = hashmap_get(m->session_units, unit); if (session) @@ -2637,7 +2631,7 @@ int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error r = sd_bus_message_read(message, "b", &b); if (r < 0) { bus_log_parse_error(r); - return r; + return 0; } if (b) diff --git a/src/login/logind-session.c b/src/login/logind-session.c index fc92f7f73b..e75c7c042e 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -656,7 +656,6 @@ int session_stop(Session *s, bool force) { } int session_finalize(Session *s) { - int r = 0; SessionDevice *sd; assert(s); @@ -682,7 +681,7 @@ int session_finalize(Session *s) { while ((sd = hashmap_first(s->devices))) session_device_free(sd); - unlink(s->state_file); + (void) unlink(s->state_file); session_add_to_gc_queue(s); user_add_to_gc_queue(s->user); @@ -702,7 +701,7 @@ int session_finalize(Session *s) { user_save(s->user); user_send_changed(s->user, "Sessions", "Display", NULL); - return r; + return 0; } static int release_timeout_callback(sd_event_source *es, uint64_t usec, void *userdata) { diff --git a/src/login/logind.c b/src/login/logind.c index 49a2811842..cf71c0ec5a 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -907,8 +907,8 @@ static void manager_gc(Manager *m, bool drop_not_started) { session_get_state(session) != SESSION_CLOSING) session_stop(session, false); - /* Normally, this should make the session busy again, - * if it doesn't then let's get rid of it + /* Normally, this should make the session referenced + * again, if it doesn't then let's get rid of it * immediately */ if (!session_check_gc(session, drop_not_started)) { session_finalize(session); |