diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-04-17 15:30:48 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-04-24 07:44:42 +0200 |
commit | 41ab8c67ebfbbdc78cda473d81d392da912c17bc (patch) | |
tree | 17a5c1e1a37023f1c0b7b5d49c33d0e4989a9123 /src/initctl/initctl.c | |
parent | dhcp-server: port to recvmsg_safe() (diff) | |
download | systemd-41ab8c67ebfbbdc78cda473d81d392da912c17bc.tar.xz systemd-41ab8c67ebfbbdc78cda473d81d392da912c17bc.zip |
tree-wide: use structured initialization at various places
Diffstat (limited to 'src/initctl/initctl.c')
-rw-r--r-- | src/initctl/initctl.c | 14 |
1 files changed, 8 insertions, 6 deletions
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); |