]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journald: debug log when we cannot read the machine ID
authorLennart Poettering <lennart@poettering.net>
Thu, 25 Oct 2018 16:35:39 +0000 (18:35 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 25 Oct 2018 19:44:48 +0000 (21:44 +0200)
src/journal/journald-server.c

index 1f19a56696b99a778cdd42ce86f3f7ed90f18a35..5a84f6aa5b57ba70126d91aa60c5ed404cff0f8e 100644 (file)
@@ -252,8 +252,9 @@ static int open_journal(
                 bool seal,
                 JournalMetrics *metrics,
                 JournalFile **ret) {
-        int r;
+
         JournalFile *f;
+        int r;
 
         assert(s);
         assert(fname);
@@ -399,14 +400,16 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
         if (uid_for_system_journal(uid))
                 return s->system_journal;
 
-        r = sd_id128_get_machine(&machine);
-        if (r < 0)
-                return s->system_journal;
-
         f = ordered_hashmap_get(s->user_journals, UID_TO_PTR(uid));
         if (f)
                 return f;
 
+        r = sd_id128_get_machine(&machine);
+        if (r < 0) {
+                log_debug_errno(r, "Failed to determine machine ID, using system log: %m");
+                return s->system_journal;
+        }
+
         if (asprintf(&p, "/var/log/journal/" SD_ID128_FORMAT_STR "/user-"UID_FMT".journal",
                      SD_ID128_FORMAT_VAL(machine), uid) < 0)
                 return s->system_journal;