X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fupdate-utmp.c;h=0d177d61645d56f7ebd37ff8e78349cf2818bd2b;hp=b06f5a06cb6be57a19de2838a6bc4cbb480c8836;hb=19c5f19d69bb5f520fa7213239490c55de06d99d;hpb=5d452f9ceceabf2bf69acb58e69a41fb41011e37 diff --git a/src/update-utmp.c b/src/update-utmp.c index b06f5a06c..0d177d616 100644 --- a/src/update-utmp.c +++ b/src/update-utmp.c @@ -284,7 +284,7 @@ static int on_shutdown(Context *c) { } #endif - if ((q = utmp_put_shutdown(0)) < 0) { + if ((q = utmp_put_shutdown()) < 0) { log_error("Failed to write utmp record: %s", strerror(-q)); r = q; } @@ -339,7 +339,7 @@ static int on_runlevel(Context *c) { } #endif - if ((q = utmp_put_runlevel(0, runlevel, previous)) < 0) { + if ((q = utmp_put_runlevel(runlevel, previous)) < 0) { log_error("Failed to write utmp record: %s", strerror(-q)); r = q; } @@ -369,12 +369,17 @@ int main(int argc, char *argv[]) { return EXIT_FAILURE; } - log_set_target(LOG_TARGET_SYSLOG_OR_KMSG); + log_set_target(LOG_TARGET_AUTO); log_parse_environment(); log_open(); + umask(0022); + #ifdef HAVE_AUDIT - if ((c.audit_fd = audit_open()) < 0) + if ((c.audit_fd = audit_open()) < 0 && + /* If the kernel lacks netlink or audit support, + * don't worry about it. */ + errno != EAFNOSUPPORT && errno != EPROTONOSUPPORT) log_error("Failed to connect to audit log: %m"); #endif