summaryrefslogtreecommitdiff
path: root/src/journal/journald-stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/journal/journald-stream.c')
-rw-r--r--src/journal/journald-stream.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c
index bdc2f49ef4..6d51c29083 100644
--- a/src/journal/journald-stream.c
+++ b/src/journal/journald-stream.c
@@ -412,13 +412,16 @@ fail:
}
int server_open_stdout_socket(Server *s) {
- union sockaddr_union sa;
int r;
struct epoll_event ev;
assert(s);
if (s->stdout_fd < 0) {
+ union sockaddr_union sa = {
+ .un.sun_family = AF_UNIX,
+ .un.sun_path = "/run/systemd/journal/stdout",
+ };
s->stdout_fd = socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
if (s->stdout_fd < 0) {
@@ -426,10 +429,6 @@ int server_open_stdout_socket(Server *s) {
return -errno;
}
- zero(sa);
- sa.un.sun_family = AF_UNIX;
- strncpy(sa.un.sun_path, "/run/systemd/journal/stdout", sizeof(sa.un.sun_path));
-
unlink(sa.un.sun_path);
r = bind(s->stdout_fd, &sa.sa, offsetof(union sockaddr_union, un.sun_path) + strlen(sa.un.sun_path));