]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journalctl: Use constants for _BOOT_ID= matches
authorJan Janssen <medhefgo@web.de>
Fri, 20 Aug 2021 17:34:22 +0000 (19:34 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 20 Aug 2021 19:40:35 +0000 (21:40 +0200)
src/journal/journalctl.c

index 15c72d5d35b25dab7bfe899e2eb32c4ed26e7a82..b1786c7954409b9959d1a1da4d51b089768d2a80 100644 (file)
@@ -1227,7 +1227,7 @@ static int discover_next_boot(sd_journal *j,
                 BootId **ret) {
 
         _cleanup_free_ BootId *next_boot = NULL;
-        char match[9+32+1] = "_BOOT_ID=";
+        char match[STRLEN("_BOOT_ID=") + SD_ID128_STRING_MAX] = "_BOOT_ID=";
         sd_id128_t boot_id;
         int r;
 
@@ -1336,7 +1336,7 @@ static int get_boots(
          * If no reference is given, the journal head/tail will do,
          * they're "virtual" boots after all. */
         if (boot_id && !sd_id128_is_null(*boot_id)) {
-                char match[9+32+1] = "_BOOT_ID=";
+                char match[STRLEN("_BOOT_ID=") + SD_ID128_STRING_MAX] = "_BOOT_ID=";
 
                 sd_journal_flush_matches(j);
 
@@ -1467,7 +1467,7 @@ static int list_boots(sd_journal *j) {
 }
 
 static int add_boot(sd_journal *j) {
-        char match[9+32+1] = "_BOOT_ID=";
+        char match[STRLEN("_BOOT_ID=") + SD_ID128_STRING_MAX] = "_BOOT_ID=";
         sd_id128_t boot_id;
         int r;