diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 13:19:16 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-11-28 13:29:21 +0100 |
commit | da927ba997d68401563b927f92e6e40e021a8e5c (patch) | |
tree | 71764cd998aef07b8943c5206c9307a93ba9c528 /src/login | |
parent | 0a1beeb64207eaa88ab9236787b1cbc2f704ae14 (diff) |
treewide: no need to negate errno for log_*_errno()
It corrrectly handles both positive and negative errno values.
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/inhibit.c | 2 | ||||
-rw-r--r-- | src/login/loginctl.c | 18 | ||||
-rw-r--r-- | src/login/logind-button.c | 2 | ||||
-rw-r--r-- | src/login/logind-core.c | 2 | ||||
-rw-r--r-- | src/login/logind-inhibit.c | 2 | ||||
-rw-r--r-- | src/login/logind-seat.c | 6 | ||||
-rw-r--r-- | src/login/logind-session.c | 4 | ||||
-rw-r--r-- | src/login/logind-user.c | 12 | ||||
-rw-r--r-- | src/login/logind.c | 70 | ||||
-rw-r--r-- | src/login/user-sessions.c | 2 |
10 files changed, 60 insertions, 60 deletions
diff --git a/src/login/inhibit.c b/src/login/inhibit.c index 3034e20f0e..db977ccc59 100644 --- a/src/login/inhibit.c +++ b/src/login/inhibit.c @@ -235,7 +235,7 @@ int main(int argc, char *argv[]) { r = sd_bus_default_system(&bus); if (r < 0) { - log_error_errno(-r, "Failed to connect to bus: %m"); + log_error_errno(r, "Failed to connect to bus: %m"); return EXIT_FAILURE; } diff --git a/src/login/loginctl.c b/src/login/loginctl.c index d0fd14b90d..80e03ebbec 100644 --- a/src/login/loginctl.c +++ b/src/login/loginctl.c @@ -385,7 +385,7 @@ static int print_session_status_info(sd_bus *bus, const char *path, bool *new_li r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i); if (r < 0) { - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); return r; } @@ -498,7 +498,7 @@ static int print_user_status_info(sd_bus *bus, const char *path, bool *new_line) r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i); if (r < 0) { - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); goto finish; } @@ -562,7 +562,7 @@ static int print_seat_status_info(sd_bus *bus, const char *path, bool *new_line) r = bus_map_all_properties(bus, "org.freedesktop.login1", path, map, &i); if (r < 0) { - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); goto finish; } @@ -617,7 +617,7 @@ static int show_properties(sd_bus *bus, const char *path, bool *new_line) { r = bus_print_all_properties(bus, "org.freedesktop.login1", path, arg_property, arg_all); if (r < 0) - log_error_errno(-r, "Could not get properties: %m"); + log_error_errno(r, "Could not get properties: %m"); return r; } @@ -700,7 +700,7 @@ static int show_user(sd_bus *bus, char **args, unsigned n) { r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to look up user %s: %m", args[i]); + log_error_errno(r, "Failed to look up user %s: %m", args[i]); return r; } @@ -860,7 +860,7 @@ static int enable_linger(sd_bus *bus, char **args, unsigned n) { r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to look up user %s: %m", args[i]); + log_error_errno(r, "Failed to look up user %s: %m", args[i]); return r; } @@ -893,7 +893,7 @@ static int terminate_user(sd_bus *bus, char **args, unsigned n) { r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to look up user %s: %m", args[i]); + log_error_errno(r, "Failed to look up user %s: %m", args[i]); return r; } @@ -929,7 +929,7 @@ static int kill_user(sd_bus *bus, char **args, unsigned n) { r = get_user_creds((const char**) (args+i), &uid, NULL, NULL, NULL); if (r < 0) { - log_error_errno(-r, "Failed to look up user %s: %m", args[i]); + log_error_errno(r, "Failed to look up user %s: %m", args[i]); return r; } @@ -1308,7 +1308,7 @@ int main(int argc, char *argv[]) { r = bus_open_transport(arg_transport, arg_host, false, &bus); if (r < 0) { - log_error_errno(-r, "Failed to create bus connection: %m"); + log_error_errno(r, "Failed to create bus connection: %m"); goto finish; } diff --git a/src/login/logind-button.c b/src/login/logind-button.c index d2cc430845..9c0c6302a9 100644 --- a/src/login/logind-button.c +++ b/src/login/logind-button.c @@ -263,7 +263,7 @@ int button_open(Button *b) { r = sd_event_add_io(b->manager->event, &b->io_event_source, b->fd, EPOLLIN, button_dispatch, b); if (r < 0) { - log_error_errno(-r, "Failed to add button event: %m"); + log_error_errno(r, "Failed to add button event: %m"); goto fail; } diff --git a/src/login/logind-core.c b/src/login/logind-core.c index 0f4ac9fb81..88694f9bac 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -551,7 +551,7 @@ bool manager_is_docked_or_multiple_displays(Manager *m) { * assume that we are docked. */ n = manager_count_displays(m); if (n < 0) - log_warning_errno(-n, "Display counting failed: %m"); + log_warning_errno(n, "Display counting failed: %m"); else if (n > 1) { log_debug("Multiple (%i) displays connected.", n); return true; diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c index 198e7df78c..84fee0e773 100644 --- a/src/login/logind-inhibit.c +++ b/src/login/logind-inhibit.c @@ -138,7 +138,7 @@ int inhibitor_save(Inhibitor *i) { finish: if (r < 0) - log_error_errno(-r, "Failed to save inhibit data %s: %m", i->state_file); + log_error_errno(r, "Failed to save inhibit data %s: %m", i->state_file); return r; } diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index 04909a991a..8eb5e3ee0a 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -154,7 +154,7 @@ int seat_save(Seat *s) { finish: if (r < 0) - log_error_errno(-r, "Failed to save seat data %s: %m", s->state_file); + log_error_errno(r, "Failed to save seat data %s: %m", s->state_file); return r; } @@ -201,7 +201,7 @@ int seat_preallocate_vts(Seat *s) { q = vt_allocate(i); if (q < 0) { - log_error_errno(-q, "Failed to preallocate VT %i: %m", i); + log_error_errno(q, "Failed to preallocate VT %i: %m", i); r = q; } } @@ -221,7 +221,7 @@ int seat_apply_acls(Seat *s, Session *old_active) { !!s->active, s->active ? s->active->user->uid : 0); if (r < 0) - log_error_errno(-r, "Failed to apply ACLs: %m"); + log_error_errno(r, "Failed to apply ACLs: %m"); return r; } diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 1cbb64c438..20161ede9d 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -292,7 +292,7 @@ int session_save(Session *s) { finish: if (r < 0) - log_error_errno(-r, "Failed to save session data %s: %m", s->state_file); + log_error_errno(r, "Failed to save session data %s: %m", s->state_file); return r; } @@ -338,7 +338,7 @@ int session_load(Session *s) { NULL); if (r < 0) { - log_error_errno(-r, "Failed to read %s: %m", s->state_file); + log_error_errno(r, "Failed to read %s: %m", s->state_file); return r; } diff --git a/src/login/logind-user.c b/src/login/logind-user.c index 7a39140d88..d2a4f7e9cb 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -252,7 +252,7 @@ int user_save(User *u) { finish: if (r < 0) - log_error_errno(-r, "Failed to save user data %s: %m", u->state_file); + log_error_errno(r, "Failed to save user data %s: %m", u->state_file); return r; } @@ -278,7 +278,7 @@ int user_load(User *u) { if (r == -ENOENT) return 0; - log_error_errno(-r, "Failed to read %s: %m", u->state_file); + log_error_errno(r, "Failed to read %s: %m", u->state_file); return r; } @@ -311,7 +311,7 @@ static int user_mkdir_runtime_path(User *u) { r = mkdir_safe_label("/run/user", 0755, 0, 0); if (r < 0) { - log_error_errno(-r, "Failed to create /run/user: %m"); + log_error_errno(r, "Failed to create /run/user: %m"); return r; } @@ -338,7 +338,7 @@ static int user_mkdir_runtime_path(User *u) { r = mount("tmpfs", p, "tmpfs", MS_NODEV|MS_NOSUID, t); if (r < 0) { - log_error_errno(-r, "Failed to mount per-user tmpfs directory %s: %m", p); + log_error_errno(r, "Failed to mount per-user tmpfs directory %s: %m", p); goto fail; } } @@ -510,14 +510,14 @@ static int user_remove_runtime_path(User *u) { r = rm_rf(u->runtime_path, false, false, false); if (r < 0) - log_error_errno(-r, "Failed to remove runtime directory %s: %m", u->runtime_path); + log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path); if (umount2(u->runtime_path, MNT_DETACH) < 0) log_error("Failed to unmount user runtime directory %s: %m", u->runtime_path); r = rm_rf(u->runtime_path, false, true, false); if (r < 0) - log_error_errno(-r, "Failed to remove runtime directory %s: %m", u->runtime_path); + log_error_errno(r, "Failed to remove runtime directory %s: %m", u->runtime_path); free(u->runtime_path); u->runtime_path = NULL; diff --git a/src/login/logind.c b/src/login/logind.c index 63e07ad9a3..d7fb1bf170 100644 --- a/src/login/logind.c +++ b/src/login/logind.c @@ -339,7 +339,7 @@ static int manager_enumerate_linger_users(Manager *m) { k = manager_add_user_by_name(m, de->d_name, NULL); if (k < 0) { - log_notice_errno(-k, "Couldn't add lingering user %s: %m", de->d_name); + log_notice_errno(k, "Couldn't add lingering user %s: %m", de->d_name); r = k; } } @@ -375,7 +375,7 @@ static int manager_enumerate_users(Manager *m) { k = manager_add_user_by_name(m, de->d_name, &u); if (k < 0) { - log_error_errno(-k, "Failed to add user by file name %s: %m", de->d_name); + log_error_errno(k, "Failed to add user by file name %s: %m", de->d_name); r = k; continue; @@ -423,7 +423,7 @@ static int manager_enumerate_sessions(Manager *m) { k = manager_add_session(m, de->d_name, &s); if (k < 0) { - log_error_errno(-k, "Failed to add session by file name %s: %m", de->d_name); + log_error_errno(k, "Failed to add session by file name %s: %m", de->d_name); r = k; continue; @@ -464,7 +464,7 @@ static int manager_enumerate_inhibitors(Manager *m) { k = manager_add_inhibitor(m, de->d_name, &i); if (k < 0) { - log_notice_errno(-k, "Couldn't add inhibitor %s: %m", de->d_name); + log_notice_errno(k, "Couldn't add inhibitor %s: %m", de->d_name); r = k; continue; } @@ -584,49 +584,49 @@ static int manager_connect_bus(Manager *m) { r = sd_bus_default_system(&m->bus); if (r < 0) { - log_error_errno(-r, "Failed to connect to system bus: %m"); + log_error_errno(r, "Failed to connect to system bus: %m"); return r; } r = sd_bus_add_object_vtable(m->bus, NULL, "/org/freedesktop/login1", "org.freedesktop.login1.Manager", manager_vtable, m); if (r < 0) { - log_error_errno(-r, "Failed to add manager object vtable: %m"); + log_error_errno(r, "Failed to add manager object vtable: %m"); return r; } r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/seat", "org.freedesktop.login1.Seat", seat_vtable, seat_object_find, m); if (r < 0) { - log_error_errno(-r, "Failed to add seat object vtable: %m"); + log_error_errno(r, "Failed to add seat object vtable: %m"); return r; } r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/seat", seat_node_enumerator, m); if (r < 0) { - log_error_errno(-r, "Failed to add seat enumerator: %m"); + log_error_errno(r, "Failed to add seat enumerator: %m"); return r; } r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/session", "org.freedesktop.login1.Session", session_vtable, session_object_find, m); if (r < 0) { - log_error_errno(-r, "Failed to add session object vtable: %m"); + log_error_errno(r, "Failed to add session object vtable: %m"); return r; } r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/session", session_node_enumerator, m); if (r < 0) { - log_error_errno(-r, "Failed to add session enumerator: %m"); + log_error_errno(r, "Failed to add session enumerator: %m"); return r; } r = sd_bus_add_fallback_vtable(m->bus, NULL, "/org/freedesktop/login1/user", "org.freedesktop.login1.User", user_vtable, user_object_find, m); if (r < 0) { - log_error_errno(-r, "Failed to add user object vtable: %m"); + log_error_errno(r, "Failed to add user object vtable: %m"); return r; } r = sd_bus_add_node_enumerator(m->bus, NULL, "/org/freedesktop/login1/user", user_node_enumerator, m); if (r < 0) { - log_error_errno(-r, "Failed to add user enumerator: %m"); + log_error_errno(r, "Failed to add user enumerator: %m"); return r; } @@ -639,7 +639,7 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/DBus'", match_name_owner_changed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for NameOwnerChanged: %m"); + log_error_errno(r, "Failed to add match for NameOwnerChanged: %m"); return r; } @@ -652,7 +652,7 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/systemd1'", match_job_removed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for JobRemoved: %m"); + log_error_errno(r, "Failed to add match for JobRemoved: %m"); return r; } @@ -665,7 +665,7 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/systemd1'", match_unit_removed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for UnitRemoved: %m"); + log_error_errno(r, "Failed to add match for UnitRemoved: %m"); return r; } @@ -677,7 +677,7 @@ static int manager_connect_bus(Manager *m) { "member='PropertiesChanged'", match_properties_changed, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for PropertiesChanged: %m"); + log_error_errno(r, "Failed to add match for PropertiesChanged: %m"); return r; } @@ -690,7 +690,7 @@ static int manager_connect_bus(Manager *m) { "path='/org/freedesktop/systemd1'", match_reloading, m); if (r < 0) { - log_error_errno(-r, "Failed to add match for Reloading: %m"); + log_error_errno(r, "Failed to add match for Reloading: %m"); return r; } @@ -709,13 +709,13 @@ static int manager_connect_bus(Manager *m) { r = sd_bus_request_name(m->bus, "org.freedesktop.login1", 0); if (r < 0) { - log_error_errno(-r, "Failed to register name: %m"); + log_error_errno(r, "Failed to register name: %m"); return r; } r = sd_bus_attach_event(m->bus, m->event, 0); if (r < 0) { - log_error_errno(-r, "Failed to attach bus to event loop: %m"); + log_error_errno(r, "Failed to attach bus to event loop: %m"); return r; } @@ -807,13 +807,13 @@ static int manager_connect_console(Manager *m) { r = ignore_signals(SIGRTMIN + 1, -1); if (r < 0) { - log_error_errno(-r, "Cannot ignore SIGRTMIN + 1: %m"); + log_error_errno(r, "Cannot ignore SIGRTMIN + 1: %m"); return r; } r = sigprocmask_many(SIG_BLOCK, SIGRTMIN, -1); if (r < 0) { - log_error_errno(-r, "Cannot block SIGRTMIN: %m"); + log_error_errno(r, "Cannot block SIGRTMIN: %m"); return r; } @@ -1017,25 +1017,25 @@ static int manager_dispatch_idle_action(sd_event_source *s, uint64_t t, void *us elapse, USEC_PER_SEC*30, manager_dispatch_idle_action, m); if (r < 0) { - log_error_errno(-r, "Failed to add idle event source: %m"); + log_error_errno(r, "Failed to add idle event source: %m"); return r; } r = sd_event_source_set_priority(m->idle_action_event_source, SD_EVENT_PRIORITY_IDLE+10); if (r < 0) { - log_error_errno(-r, "Failed to set idle event source priority: %m"); + log_error_errno(r, "Failed to set idle event source priority: %m"); return r; } } else { r = sd_event_source_set_time(m->idle_action_event_source, elapse); if (r < 0) { - log_error_errno(-r, "Failed to set idle event timer: %m"); + log_error_errno(r, "Failed to set idle event timer: %m"); return r; } r = sd_event_source_set_enabled(m->idle_action_event_source, SD_EVENT_ONESHOT); if (r < 0) { - log_error_errno(-r, "Failed to enable idle event timer: %m"); + log_error_errno(r, "Failed to enable idle event timer: %m"); return r; } } @@ -1062,7 +1062,7 @@ int manager_startup(Manager *m) { /* Connect to udev */ r = manager_connect_udev(m); if (r < 0) { - log_error_errno(-r, "Failed to create udev watchers: %m"); + log_error_errno(r, "Failed to create udev watchers: %m"); return r; } @@ -1074,38 +1074,38 @@ int manager_startup(Manager *m) { /* Instantiate magic seat 0 */ r = manager_add_seat(m, "seat0", &m->seat0); if (r < 0) { - log_error_errno(-r, "Failed to add seat0: %m"); + log_error_errno(r, "Failed to add seat0: %m"); return r; } r = manager_set_lid_switch_ignore(m, 0 + IGNORE_LID_SWITCH_STARTUP_USEC); if (r < 0) - log_warning_errno(-r, "Failed to set up lid switch ignore event source: %m"); + log_warning_errno(r, "Failed to set up lid switch ignore event source: %m"); /* Deserialize state */ r = manager_enumerate_devices(m); if (r < 0) - log_warning_errno(-r, "Device enumeration failed: %m"); + log_warning_errno(r, "Device enumeration failed: %m"); r = manager_enumerate_seats(m); if (r < 0) - log_warning_errno(-r, "Seat enumeration failed: %m"); + log_warning_errno(r, "Seat enumeration failed: %m"); r = manager_enumerate_users(m); if (r < 0) - log_warning_errno(-r, "User enumeration failed: %m"); + log_warning_errno(r, "User enumeration failed: %m"); r = manager_enumerate_sessions(m); if (r < 0) - log_warning_errno(-r, "Session enumeration failed: %m"); + log_warning_errno(r, "Session enumeration failed: %m"); r = manager_enumerate_inhibitors(m); if (r < 0) - log_warning_errno(-r, "Inhibitor enumeration failed: %m"); + log_warning_errno(r, "Inhibitor enumeration failed: %m"); r = manager_enumerate_buttons(m); if (r < 0) - log_warning_errno(-r, "Button enumeration failed: %m"); + log_warning_errno(r, "Button enumeration failed: %m"); /* Remove stale objects before we start them */ manager_gc(m, false); @@ -1214,7 +1214,7 @@ int main(int argc, char *argv[]) { r = manager_startup(m); if (r < 0) { - log_error_errno(-r, "Failed to fully start up daemon: %m"); + log_error_errno(r, "Failed to fully start up daemon: %m"); goto finish; } diff --git a/src/login/user-sessions.c b/src/login/user-sessions.c index 3639a1836b..fb0afc5e50 100644 --- a/src/login/user-sessions.c +++ b/src/login/user-sessions.c @@ -68,7 +68,7 @@ int main(int argc, char*argv[]) { r = write_string_file_atomic("/run/nologin", "System is going down."); if (r < 0) { - log_error_errno(-r, "Failed to create /run/nologin: %m"); + log_error_errno(r, "Failed to create /run/nologin: %m"); return EXIT_FAILURE; } |