X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fupdate-utmp%2Fupdate-utmp.c;h=15da83193b1643605afa5aeb94c2056bc2eedb61;hp=a5dd8a92364fab0cf79917c89fc24021bc52fe81;hb=75e52a16f9ef476f1d18ec6d9c84e00149b80d03;hpb=0a1beeb64207eaa88ab9236787b1cbc2f704ae14 diff --git a/src/update-utmp/update-utmp.c b/src/update-utmp/update-utmp.c index a5dd8a923..15da83193 100644 --- a/src/update-utmp/update-utmp.c +++ b/src/update-utmp/update-utmp.c @@ -133,7 +133,7 @@ static int on_reboot(Context *c) { if (c->audit_fd >= 0) if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 && errno != EPERM) { - log_error("Failed to send audit message: %m"); + log_error_errno(errno, "Failed to send audit message: %m"); r = -errno; } #endif @@ -144,7 +144,7 @@ static int on_reboot(Context *c) { q = utmp_put_reboot(t); if (q < 0) { - log_error_errno(-q, "Failed to write utmp record: %m"); + log_error_errno(q, "Failed to write utmp record: %m"); r = q; } @@ -163,14 +163,14 @@ static int on_shutdown(Context *c) { if (c->audit_fd >= 0) if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "", "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 && errno != EPERM) { - log_error("Failed to send audit message: %m"); + log_error_errno(errno, "Failed to send audit message: %m"); r = -errno; } #endif q = utmp_put_shutdown(); if (q < 0) { - log_error_errno(-q, "Failed to write utmp record: %m"); + log_error_errno(q, "Failed to write utmp record: %m"); r = q; } @@ -189,10 +189,8 @@ static int on_runlevel(Context *c) { q = utmp_get_runlevel(&previous, NULL); if (q < 0) { - if (q != -ESRCH && q != -ENOENT) { - log_error_errno(-q, "Failed to get current runlevel: %m"); - return q; - } + if (q != -ESRCH && q != -ENOENT) + return log_error_errno(q, "Failed to get current runlevel: %m"); previous = 0; } @@ -217,7 +215,7 @@ static int on_runlevel(Context *c) { if (audit_log_user_comm_message(c->audit_fd, AUDIT_SYSTEM_RUNLEVEL, s, "systemd-update-utmp", NULL, NULL, NULL, 1) < 0 && errno != EPERM) { - log_error("Failed to send audit message: %m"); + log_error_errno(errno, "Failed to send audit message: %m"); r = -errno; } } @@ -225,7 +223,7 @@ static int on_runlevel(Context *c) { q = utmp_put_runlevel(runlevel, previous); if (q < 0 && q != -ESRCH && q != -ENOENT) { - log_error_errno(-q, "Failed to write utmp record: %m"); + log_error_errno(q, "Failed to write utmp record: %m"); r = q; } @@ -261,11 +259,11 @@ int main(int argc, char *argv[]) { * don't worry about it. */ c.audit_fd = audit_open(); if (c.audit_fd < 0 && errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT) - log_error("Failed to connect to audit log: %m"); + log_error_errno(errno, "Failed to connect to audit log: %m"); #endif r = bus_open_system_systemd(&c.bus); if (r < 0) { - log_error_errno(-r, "Failed to get D-Bus connection: %m"); + log_error_errno(r, "Failed to get D-Bus connection: %m"); r = -EIO; goto finish; }