chiark / gitweb /
log: SCM_CREDENTIALS will be added by the kernel anyway, so there's no need to write...
[elogind.git] / src / update-utmp.c
index b8b0d36ae7536e8518c68d172f55b841c3476221..5a48bd98dd9cf682f829933513d09a00b28fa4d4 100644 (file)
@@ -1,4 +1,4 @@
-/*-*- Mode: C; c-basic-offset: 8 -*-*/
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
 
 /***
   This file is part of systemd.
 #include <assert.h>
 #include <errno.h>
 #include <string.h>
-#include <libaudit.h>
 #include <sys/types.h>
 #include <unistd.h>
 
 #include <dbus/dbus.h>
 
+#ifdef HAVE_AUDIT
+#include <libaudit.h>
+#endif
+
 #include "log.h"
 #include "macro.h"
 #include "util.h"
@@ -244,7 +247,7 @@ static int on_reboot(Context *c) {
 
 #ifdef HAVE_AUDIT
         if (c->audit_fd >= 0)
-                if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "", NULL, NULL, NULL, 1) < 0) {
+                if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_BOOT, "init", NULL, NULL, NULL, 1) < 0) {
                         log_error("Failed to send audit message: %m");
                         r = -errno;
                 }
@@ -272,7 +275,7 @@ static int on_shutdown(Context *c) {
 
 #ifdef HAVE_AUDIT
         if (c->audit_fd >= 0)
-                if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "", NULL, NULL, NULL, 1) < 0) {
+                if (audit_log_user_message(c->audit_fd, AUDIT_SYSTEM_SHUTDOWN, "init", NULL, NULL, NULL, 1) < 0) {
                         log_error("Failed to send audit message: %m");
                         r = -errno;
                 }
@@ -308,7 +311,7 @@ static int on_runlevel(Context *c) {
                 previous = 0;
         }
 
-        /* Second get new runlevel */
+        /* Secondly, get new runlevel */
         if ((runlevel = get_current_runlevel(c)) < 0)
                 return runlevel;
 
@@ -365,6 +368,7 @@ int main(int argc, char *argv[]) {
 
         log_set_target(LOG_TARGET_SYSLOG_OR_KMSG);
         log_parse_environment();
+        log_open();
 
 #ifdef HAVE_AUDIT
         if ((c.audit_fd = audit_open()) < 0)