diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:42 +0000 |
commit | 78e9bb837c258ac0ec7712b3d612cc2f407e731e (patch) | |
tree | f515d16b6efd858a9aeb5b0ef5d6f90bf288283d /man/journal-stream-fd.c | |
parent | Adding debian version 255.5-1. (diff) | |
download | systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.tar.xz systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.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.c | 8 |
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; } |