diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-02-20 13:12:27 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-03-01 12:00:32 -0800 |
commit | 31db8a08be445b252ba27b07106ca5b2e73cc325 (patch) | |
tree | 94f6c3a76dc2d8025c42288e17774f3cb674a01b /lib | |
parent | b2114eb3b01a6259265391fbc41f0492bc26596e (diff) | |
download | samba-31db8a08be445b252ba27b07106ca5b2e73cc325.tar.gz samba-31db8a08be445b252ba27b07106ca5b2e73cc325.tar.bz2 samba-31db8a08be445b252ba27b07106ca5b2e73cc325.zip |
tevent: use helper variables to hold the epoll_ctl() result
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tevent/tevent_epoll.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c index bdf57350fb..a662fee3a6 100644 --- a/lib/tevent/tevent_epoll.c +++ b/lib/tevent/tevent_epoll.c @@ -267,6 +267,7 @@ static void epoll_check_reopen(struct epoll_event_context *epoll_ev) static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde) { struct epoll_event event; + int ret; fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; @@ -276,7 +277,8 @@ static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_ ZERO_STRUCT(event); event.events = epoll_map_flags(fde->flags); event.data.ptr = fde; - if (epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_ADD, fde->fd, &event) != 0) { + ret = epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_ADD, fde->fd, &event); + if (ret != 0) { epoll_panic(epoll_ev, "EPOLL_CTL_ADD failed", false); return; } @@ -294,6 +296,7 @@ static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_ static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde) { struct epoll_event event; + int ret; fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; @@ -303,7 +306,8 @@ static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_ ZERO_STRUCT(event); event.events = epoll_map_flags(fde->flags); event.data.ptr = fde; - if (epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_DEL, fde->fd, &event) != 0) { + ret = epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_DEL, fde->fd, &event); + if (ret != 0) { tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL, "epoll_del_event failed! probable early close bug (%s)\n", strerror(errno)); @@ -317,13 +321,15 @@ static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_ static void epoll_mod_event(struct epoll_event_context *epoll_ev, struct tevent_fd *fde) { struct epoll_event event; + int ret; fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; ZERO_STRUCT(event); event.events = epoll_map_flags(fde->flags); event.data.ptr = fde; - if (epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_MOD, fde->fd, &event) != 0) { + ret = epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_MOD, fde->fd, &event); + if (ret != 0) { epoll_panic(epoll_ev, "EPOLL_CTL_MOD failed", false); return; } |