From 41ab8c67ebfbbdc78cda473d81d392da912c17bc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 17 Apr 2020 15:30:48 +0200 Subject: tree-wide: use structured initialization at various places --- src/initctl/initctl.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/initctl/initctl.c') diff --git a/src/initctl/initctl.c b/src/initctl/initctl.c index 150d0fb199..7505512fe7 100644 --- a/src/initctl/initctl.c +++ b/src/initctl/initctl.c @@ -246,9 +246,10 @@ static int server_init(Server *s, unsigned n_sockets) { assert(s); assert(n_sockets > 0); - zero(*s); + *s = (struct Server) { + .epoll_fd = epoll_create1(EPOLL_CLOEXEC), + }; - s->epoll_fd = epoll_create1(EPOLL_CLOEXEC); if (s->epoll_fd < 0) { r = log_error_errno(errno, "Failed to create epoll object: %m"); @@ -256,7 +257,6 @@ static int server_init(Server *s, unsigned n_sockets) { } for (i = 0; i < n_sockets; i++) { - struct epoll_event ev; Fifo *f; int fd; @@ -283,9 +283,11 @@ static int server_init(Server *s, unsigned n_sockets) { f->fd = -1; - zero(ev); - ev.events = EPOLLIN; - ev.data.ptr = f; + struct epoll_event ev = { + .events = EPOLLIN, + .data.ptr = f, + }; + if (epoll_ctl(s->epoll_fd, EPOLL_CTL_ADD, fd, &ev) < 0) { r = -errno; fifo_free(f); -- cgit v1.2.3