summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Janssen <medhefgo@web.de>2021-09-02 13:28:55 +0200
committerLennart Poettering <lennart@poettering.net>2021-09-03 09:58:07 +0200
commit0d5765f7af96702031a6ce12d2f65238337a2e40 (patch)
treefc1cd660c294f5e187360fe6bad697c141720e75
parentb2cdc2c05ee77405fa00f3a330bd19cb755a01d0 (diff)
downloadsystemd-0d5765f7af96702031a6ce12d2f65238337a2e40.tar.gz
journalctl: Use constants in some more places
-rw-r--r--src/journal/journalctl.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index b1786c7954..4a2343a63d 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -276,13 +276,13 @@ static int parse_boot_descriptor(const char *x, sd_id128_t *boot_id, int *offset
*boot_id = SD_ID128_NULL;
*offset = 0;
return 0;
- } else if (strlen(x) >= 32) {
+ } else if (strlen(x) >= SD_ID128_STRING_MAX - 1) {
char *t;
- t = strndupa(x, 32);
+ t = strndupa(x, SD_ID128_STRING_MAX - 1);
r = sd_id128_from_string(t, &id);
if (r >= 0)
- x += 32;
+ x += SD_ID128_STRING_MAX - 1;
if (!IN_SET(*x, 0, '-', '+'))
return -EINVAL;
@@ -1280,7 +1280,7 @@ static int discover_next_boot(sd_journal *j,
return r;
/* Now seek to the last occurrence of this boot ID. */
- sd_id128_to_string(next_boot->id, match + 9);
+ sd_id128_to_string(next_boot->id, match + STRLEN("_BOOT_ID="));
r = sd_journal_add_match(j, match, sizeof(match) - 1);
if (r < 0)
return r;
@@ -1340,7 +1340,7 @@ static int get_boots(
sd_journal_flush_matches(j);
- sd_id128_to_string(*boot_id, match + 9);
+ sd_id128_to_string(*boot_id, match + STRLEN("_BOOT_ID="));
r = sd_journal_add_match(j, match, sizeof(match) - 1);
if (r < 0)
return r;
@@ -1499,7 +1499,7 @@ static int add_boot(sd_journal *j) {
return r == 0 ? -ENODATA : r;
}
- sd_id128_to_string(boot_id, match + 9);
+ sd_id128_to_string(boot_id, match + STRLEN("_BOOT_ID="));
r = sd_journal_add_match(j, match, sizeof(match) - 1);
if (r < 0)