diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:45 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:45 +0000 |
commit | efeb864cb547a2cbf96dc0053a8bdb4d9190b364 (patch) | |
tree | c0b83368f18be983fcc763200c4c24d633244588 /man/journal-iterate-foreach.c | |
parent | Releasing progress-linux version 255.5-1~progress7.99u1. (diff) | |
download | systemd-efeb864cb547a2cbf96dc0053a8bdb4d9190b364.tar.xz systemd-efeb864cb547a2cbf96dc0053a8bdb4d9190b364.zip |
Merging upstream version 256.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'man/journal-iterate-foreach.c')
-rw-r--r-- | man/journal-iterate-foreach.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/man/journal-iterate-foreach.c b/man/journal-iterate-foreach.c index 381b50f..9c0fa0e 100644 --- a/man/journal-iterate-foreach.c +++ b/man/journal-iterate-foreach.c @@ -7,10 +7,10 @@ int main(int argc, char *argv[]) { int r; sd_journal *j; + r = sd_journal_open(&j, SD_JOURNAL_LOCAL_ONLY); if (r < 0) { - errno = -r; - fprintf(stderr, "Failed to open journal: %m\n"); + fprintf(stderr, "Failed to open journal: %s\n", strerror(-r)); return 1; } SD_JOURNAL_FOREACH(j) { @@ -19,8 +19,7 @@ int main(int argc, char *argv[]) { r = sd_journal_get_data(j, "MESSAGE", (const void **)&d, &l); if (r < 0) { - errno = -r; - fprintf(stderr, "Failed to read message field: %m\n"); + fprintf(stderr, "Failed to read message field: %s\n", strerror(-r)); continue; } |