chiark / gitweb /
systemctl: limit logs in status to current boot
[elogind.git] / src / journal / journalctl.c
index 2e672fa09655fb93dd26774c5acb6b73ebfc5e49..eb79c4d8537e192d61b4f31537fa339ac510b2b6 100644 (file)
@@ -591,33 +591,10 @@ static int add_matches(sd_journal *j, char **args) {
 }
 
 static int add_this_boot(sd_journal *j) {
-        char match[9+32+1] = "_BOOT_ID=";
-        sd_id128_t boot_id;
-        int r;
-
-        assert(j);
-
         if (!arg_this_boot)
                 return 0;
 
-        r = sd_id128_get_boot(&boot_id);
-        if (r < 0) {
-                log_error("Failed to get boot id: %s", strerror(-r));
-                return r;
-        }
-
-        sd_id128_to_string(boot_id, match + 9);
-        r = sd_journal_add_match(j, match, strlen(match));
-        if (r < 0) {
-                log_error("Failed to add match: %s", strerror(-r));
-                return r;
-        }
-
-        r = sd_journal_add_conjunction(j);
-        if (r < 0)
-                return r;
-
-        return 0;
+        return add_match_this_boot(j);
 }
 
 static int add_dmesg(sd_journal *j) {