X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fjournal%2Fjournald-stream.c;h=9c4efec9bcd4713f83285a0088ddbab259a149bb;hp=113c4214f843e116c75d41b947e733a81893854c;hb=5862d652ba14178cff46b8a8fc6c6d8392bf32b1;hpb=4871690d9e32608bbd9b18505b5326c2079c9690 diff --git a/src/journal/journald-stream.c b/src/journal/journald-stream.c index 113c4214f..9c4efec9b 100644 --- a/src/journal/journald-stream.c +++ b/src/journal/journald-stream.c @@ -29,7 +29,7 @@ #endif #include "socket-util.h" -#include "journald.h" +#include "journald-server.h" #include "journald-stream.h" #include "journald-syslog.h" #include "journald-kmsg.h" @@ -90,7 +90,7 @@ static int stdout_stream_log(StdoutStream *s, const char *p) { priority = s->priority; if (s->level_prefix) - syslog_parse_priority((char**) &p, &priority); + syslog_parse_priority((char**) &p, &priority, false); if (s->forward_to_syslog || s->server->forward_to_syslog) server_forward_syslog(s->server, syslog_fixup_facility(priority), s->identifier, p, &s->ucred, NULL); @@ -127,7 +127,7 @@ static int stdout_stream_log(StdoutStream *s, const char *p) { } #endif - server_dispatch_message(s->server, iovec, n, ELEMENTSOF(iovec), &s->ucred, NULL, label, label_len, s->unit_id, priority); + server_dispatch_message(s->server, iovec, n, ELEMENTSOF(iovec), &s->ucred, NULL, label, label_len, s->unit_id, priority, 0); free(message); free(syslog_priority); @@ -175,7 +175,7 @@ static int stdout_stream_line(StdoutStream *s, char *p) { case STDOUT_STREAM_PRIORITY: r = safe_atoi(p, &s->priority); - if (r < 0 || s->priority <= 0 || s->priority >= 999) { + if (r < 0 || s->priority < 0 || s->priority > 999) { log_warning("Failed to parse log priority line."); return -EINVAL; } @@ -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)); @@ -441,7 +440,7 @@ int server_open_stdout_socket(Server *s) { chmod(sa.un.sun_path, 0666); if (listen(s->stdout_fd, SOMAXCONN) < 0) { - log_error("liste() failed: %m"); + log_error("listen() failed: %m"); return -errno; } } else