X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=socket.c;h=dd5076552020e9a79918e06f2afcd2873fed2a78;hb=ef886c6ab86436f0d8b5128799a8f801c62d859a;hp=7bcd112739c36f5261bb77e961beb960f63998b4;hpb=d6ea93e31d96c67366feee0413a3c307fcffea2b;p=elogind.git diff --git a/socket.c b/socket.c index 7bcd11273..dd5076552 100644 --- a/socket.c +++ b/socket.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include "unit.h" @@ -88,8 +88,11 @@ static int socket_init(Unit *u) { s->timeout_usec = DEFAULT_TIMEOUT_USEC; exec_context_init(&s->exec_context); - if ((r = unit_load_fragment_and_dropin(u)) < 0) + if ((r = unit_load_fragment_and_dropin(u)) <= 0) { + if (r == 0) + r = -ENOENT; goto fail; + } if (!(t = unit_name_change_suffix(unit_id(u), ".service"))) { r = -ENOMEM; @@ -282,7 +285,7 @@ static int socket_watch_fds(Socket *s) { if (p->fd < 0) continue; - if ((r = unit_watch_fd(UNIT(s), p->fd, POLLIN, &p->fd_watch)) < 0) + if ((r = unit_watch_fd(UNIT(s), p->fd, EPOLLIN, &p->fd_watch)) < 0) goto fail; } @@ -631,7 +634,7 @@ static void socket_fd_event(Unit *u, int fd, uint32_t events, Watch *w) { log_debug("Incoming traffic on %s", unit_id(u)); - if (events != POLLIN) + if (events != EPOLLIN) socket_enter_stop_pre(s, false); socket_enter_running(s); @@ -653,7 +656,7 @@ static void socket_sigchld_event(Unit *u, pid_t pid, int code, int status) { exec_status_fill(&s->control_command->exec_status, pid, code, status); s->control_pid = 0; - log_debug("%s control process exited, code=%s status=%i", unit_id(u), sigchld_code(code), status); + log_debug("%s control process exited, code=%s status=%i", unit_id(u), sigchld_code_to_string(code), status); if (s->control_command->command_next && (success || (s->state == SOCKET_EXEC_STOP_PRE || s->state == SOCKET_EXEC_STOP_POST))) {