diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-15 17:19:15 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-09-15 17:19:15 +0200 |
commit | 00e313d7e9fc487b445b05324148a8931941b8f0 (patch) | |
tree | f82ffe4d63e5b018bc44b93d9c541d615f4f1a7e /src/poll.c | |
parent | cfc893eae959230c63cada9855914a9091acd9f4 (diff) | |
download | fastd-00e313d7e9fc487b445b05324148a8931941b8f0.tar fastd-00e313d7e9fc487b445b05324148a8931941b8f0.zip |
Don't try to poll on invalid status socket FD
Diffstat (limited to 'src/poll.c')
-rw-r--r-- | src/poll.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -84,13 +84,15 @@ void fastd_poll_init(void) { exit_errno("epoll_ctl"); #ifdef WITH_STATUS_SOCKET - struct epoll_event event_status = { - .events = EPOLLIN, - .data.ptr = &ctx.status_fd, - }; + if (ctx.status_fd >= 0) { + struct epoll_event event_status = { + .events = EPOLLIN, + .data.ptr = &ctx.status_fd, + }; - if (epoll_ctl(ctx.epoll_fd, EPOLL_CTL_ADD, ctx.status_fd, &event_status) < 0) - exit_errno("epoll_ctl"); + if (epoll_ctl(ctx.epoll_fd, EPOLL_CTL_ADD, ctx.status_fd, &event_status) < 0) + exit_errno("epoll_ctl"); + } #endif } |