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=e45bee10ceee237699c3b707d8d4271da5398075;hb=6bc1ce40e531257ae8dd9bbbbcb48e5de0a1187b;hpb=22f4096ca96acd504ac74e7dfad96f07edb6da51 diff --git a/src/update-utmp.c b/src/update-utmp.c index e45bee10c..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 @@ -406,8 +411,9 @@ finish: #endif if (c.bus) { - dbus_connection_close(c.bus); - dbus_connection_unref(c.bus); + dbus_connection_flush(c.bus); + dbus_connection_close(c.bus); + dbus_connection_unref(c.bus); } dbus_error_free(&error);