X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Finitctl%2Finitctl.c;h=d7cd4ba29f0cc29610d7a321d225f62cabbc1796;hb=d0a2e1c364320b862a6aae099afa106ea59bb84c;hp=4c7efa74a302dac7ae6d917e658f5b18b6515955;hpb=0a1beeb64207eaa88ab9236787b1cbc2f704ae14;p=elogind.git diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c index 4c7efa74a..d7cd4ba29 100644 --- a/src/initctl/initctl.c +++ b/src/initctl/initctl.c @@ -162,7 +162,7 @@ static void request_process(Server *s, const struct init_request *req) { case 'u': case 'U': if (kill(1, SIGTERM) < 0) - log_error("kill() failed: %m"); + log_error_errno(errno, "kill() failed: %m"); /* The bus connection will be * terminated if PID 1 is reexecuted, @@ -175,7 +175,7 @@ static void request_process(Server *s, const struct init_request *req) { case 'q': case 'Q': if (kill(1, SIGHUP) < 0) - log_error("kill() failed: %m"); + log_error_errno(errno, "kill() failed: %m"); break; default: @@ -217,7 +217,7 @@ static int fifo_process(Fifo *f) { if (errno == EAGAIN) return 0; - log_warning("Failed to read from fifo: %m"); + log_warning_errno(errno, "Failed to read from fifo: %m"); return -errno; } @@ -277,7 +277,7 @@ static int server_init(Server *s, unsigned n_sockets) { s->epoll_fd = epoll_create1(EPOLL_CLOEXEC); if (s->epoll_fd < 0) { r = -errno; - log_error("Failed to create epoll object: %m"); + log_error_errno(errno, "Failed to create epoll object: %m"); goto fail; } @@ -290,8 +290,7 @@ static int server_init(Server *s, unsigned n_sockets) { r = sd_is_fifo(fd, NULL); if (r < 0) { - log_error("Failed to determine file descriptor type: %s", - strerror(-r)); + log_error_errno(r, "Failed to determine file descriptor type: %m"); goto fail; } @@ -304,7 +303,7 @@ static int server_init(Server *s, unsigned n_sockets) { f = new0(Fifo, 1); if (!f) { r = -ENOMEM; - log_error("Failed to create fifo object: %m"); + log_error_errno(errno, "Failed to create fifo object: %m"); goto fail; } @@ -316,7 +315,7 @@ static int server_init(Server *s, unsigned n_sockets) { if (epoll_ctl(s->epoll_fd, EPOLL_CTL_ADD, fd, &ev) < 0) { r = -errno; fifo_free(f); - log_error("Failed to add fifo fd to epoll object: %m"); + log_error_errno(errno, "Failed to add fifo fd to epoll object: %m"); goto fail; } @@ -328,7 +327,7 @@ static int server_init(Server *s, unsigned n_sockets) { r = bus_open_system_systemd(&s->bus); if (r < 0) { - log_error_errno(-r, "Failed to get D-Bus connection: %m"); + log_error_errno(r, "Failed to get D-Bus connection: %m"); r = -EIO; goto fail; } @@ -355,7 +354,7 @@ static int process_event(Server *s, struct epoll_event *ev) { f = (Fifo*) ev->data.ptr; r = fifo_process(f); if (r < 0) { - log_info_errno(-r, "Got error on fifo: %m"); + log_info_errno(r, "Got error on fifo: %m"); fifo_free(f); return r; } @@ -385,7 +384,7 @@ int main(int argc, char *argv[]) { n = sd_listen_fds(true); if (n < 0) { - log_error_errno(-r, "Failed to read listening file descriptors from environment: %m"); + log_error_errno(r, "Failed to read listening file descriptors from environment: %m"); return EXIT_FAILURE; } @@ -414,7 +413,7 @@ int main(int argc, char *argv[]) { if (errno == EINTR) continue; - log_error("epoll_wait() failed: %m"); + log_error_errno(errno, "epoll_wait() failed: %m"); goto fail; }