chiark / gitweb /
journald: Log error when failed to get machine-id on start
authorOlivier Brunel <jjk@jjacky.com>
Thu, 12 Sep 2013 12:37:30 +0000 (14:37 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 12 Sep 2013 16:19:16 +0000 (18:19 +0200)
Can help since the journal requires /etc/machine-id to exists in order to start,
and will simply silently exit when it does not.

src/journal/journald-server.c

index 9daeb6e9e71703be609dee7c9921a2d60b372d8f..ba211b3724f99fe8518fe430472efc60419ea1c9 100644 (file)
@@ -897,8 +897,10 @@ static int system_journal_open(Server *s) {
         char ids[33];
 
         r = sd_id128_get_machine(&machine);
-        if (r < 0)
+        if (r < 0) {
+                log_error("Failed to get machine id: %s", strerror(-r));
                 return r;
+        }
 
         sd_id128_to_string(machine, ids);
 
@@ -1000,10 +1002,8 @@ int server_flush_to_var(Server *s) {
         log_debug("Flushing to /var...");
 
         r = sd_id128_get_machine(&machine);
-        if (r < 0) {
-                log_error("Failed to get machine id: %s", strerror(-r));
+        if (r < 0)
                 return r;
-        }
 
         r = sd_journal_open(&j, SD_JOURNAL_RUNTIME_ONLY);
         if (r < 0) {