chiark / gitweb /
journald: fix _SYSTEMD_CGROUP= values
[elogind.git] / src / journal / journald.c
index 5c8e713657409e9a57e920c94809c891fdcc0051..b42be8d7ad2788ef55d409fdb326b1c5b5dd8036 100644 (file)
@@ -391,7 +391,9 @@ static char *shortened_cgroup_path(pid_t pid) {
                 return NULL;
         }
 
-        if (streq(init_path, "/"))
+        if (endswith(init_path, "/system"))
+                init_path[strlen(init_path) - 7] = 0;
+        else if (streq(init_path, "/"))
                 init_path[0] = 0;
 
         if (startswith(process_path, init_path)) {
@@ -1196,12 +1198,10 @@ static int system_journal_open(Server *s) {
                         fix_perms(s->system_journal, 0);
                 } else if (r < 0) {
 
-                        if (r == -ENOENT || r == -EROFS)
-                                r = 0;
-                        else {
-                                log_error("Failed to open system journal: %s", strerror(-r));
-                                return r;
-                        }
+                        if (r != -ENOENT && r != -EROFS)
+                                log_warning("Failed to open system journal: %s", strerror(-r));
+
+                        r = 0;
                 }
         }
 
@@ -1221,13 +1221,10 @@ static int system_journal_open(Server *s) {
                         free(fn);
 
                         if (r < 0) {
+                                if (r != -ENOENT)
+                                        log_warning("Failed to open runtime journal: %s", strerror(-r));
 
-                                if (r == -ENOENT)
-                                        r = 0;
-                                else {
-                                        log_error("Failed to open runtime journal: %s", strerror(-r));
-                                        return r;
-                                }
+                                r = 0;
                         }
 
                 } else {