summaryrefslogtreecommitdiffstats
path: root/man/journal-stream-fd.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:45 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 03:50:45 +0000
commitefeb864cb547a2cbf96dc0053a8bdb4d9190b364 (patch)
treec0b83368f18be983fcc763200c4c24d633244588 /man/journal-stream-fd.c
parentReleasing progress-linux version 255.5-1~progress7.99u1. (diff)
downloadsystemd-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-stream-fd.c')
-rw-r--r--man/journal-stream-fd.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/man/journal-stream-fd.c b/man/journal-stream-fd.c
index 8aad5ff..595091a 100644
--- a/man/journal-stream-fd.c
+++ b/man/journal-stream-fd.c
@@ -1,5 +1,6 @@
/* SPDX-License-Identifier: MIT-0 */
+#define _GNU_SOURCE 1
#include <errno.h>
#include <syslog.h>
#include <stdio.h>
@@ -10,15 +11,16 @@
int main(int argc, char *argv[]) {
int fd;
FILE *log;
+
fd = sd_journal_stream_fd("test", LOG_INFO, 1);
if (fd < 0) {
- errno = -fd;
- fprintf(stderr, "Failed to create stream fd: %m\n");
+ fprintf(stderr, "Failed to create stream fd: %s\n", strerror(-fd));
return 1;
}
+
log = fdopen(fd, "w");
if (!log) {
- fprintf(stderr, "Failed to create file object: %m\n");
+ fprintf(stderr, "Failed to create file object: %s\n", strerror(errno));
close(fd);
return 1;
}