chiark / gitweb /
man: fix typo in sd_notify
[elogind.git] / src / update-utmp.c
index e45bee10ceee237699c3b707d8d4271da5398075..073f28e2544478ffb6cadeece26e67bad977102b 100644 (file)
@@ -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;
         }
@@ -373,8 +373,13 @@ int main(int argc, char *argv[]) {
         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);