X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Finitctl%2Finitctl.c;h=468df35bac9eef2920a29715324f87ef002f5270;hp=3c5986171fe054bba27f57bb41efb4346a9e2ce8;hb=f168c27313e4d7b0aabee037dc9c78a5799f0597;hpb=b75b4db0af92514fce3955a1350b77c3c42e7f77 diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c index 3c5986171..468df35ba 100644 --- a/src/initctl/initctl.c +++ b/src/initctl/initctl.c @@ -114,7 +114,7 @@ static void change_runlevel(Server *s, int runlevel) { assert(s); target = translate_runlevel(runlevel, &isolate); - if(!target) { + if (!target) { log_warning("Got request for unknown runlevel %c, ignoring.", runlevel); return; } @@ -217,7 +217,7 @@ static int fifo_process(Fifo *f) { if (errno == EAGAIN) return 0; - log_warning("Failed to read from fifo: %s", strerror(errno)); + log_warning("Failed to read from fifo: %m"); return -1; } @@ -278,7 +278,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: %s", strerror(errno)); + log_error("Failed to create epoll object: %m"); goto fail; } @@ -305,8 +305,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: %s", - strerror(errno)); + log_error("Failed to create fifo object: %m"); goto fail; } @@ -318,8 +317,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: %s", - strerror(errno)); + log_error("Failed to add fifo fd to epoll object: %m"); goto fail; } @@ -329,7 +327,7 @@ static int server_init(Server *s, unsigned n_sockets) { s->n_fifos ++; } - r = bus_connect_system(&s->bus); + r = bus_open_system_systemd(&s->bus); if (r < 0) { log_error("Failed to get D-Bus connection: %s", strerror(-r)); r = -EIO; @@ -416,7 +414,7 @@ int main(int argc, char *argv[]) { if (errno == EINTR) continue; - log_error("epoll_wait() failed: %s", strerror(errno)); + log_error("epoll_wait() failed: %m"); goto fail; }