summaryrefslogtreecommitdiff
path: root/lib/tevent/tevent_select.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-02-15 11:24:59 +0100
committerJeremy Allison <jra@samba.org>2013-03-01 11:59:20 -0800
commitf86df3e364f55be5f320463e3c1b89ee3a49115e (patch)
tree4d99837b8a253a72bdf8cb6004184cf6808917ff /lib/tevent/tevent_select.c
parent883d20a9bf7444e6338e13d6efbcbc257e1d78b7 (diff)
downloadsamba-f86df3e364f55be5f320463e3c1b89ee3a49115e.tar.gz
samba-f86df3e364f55be5f320463e3c1b89ee3a49115e.tar.bz2
samba-f86df3e364f55be5f320463e3c1b89ee3a49115e.zip
tevent: remember the errno from select(), poll() and epoll_wait()
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/tevent/tevent_select.c')
-rw-r--r--lib/tevent/tevent_select.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index 7e0c927dd9..ffb0d18c2e 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -144,6 +144,7 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
fd_set r_fds, w_fds;
struct tevent_fd *fde;
int selrtn;
+ int select_errno;
/* we maybe need to recalculate the maxfd */
if (select_ev->maxfd == EVENT_INVALID_MAXFD) {
@@ -175,15 +176,16 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
tevent_trace_point_callback(select_ev->ev, TEVENT_TRACE_BEFORE_WAIT);
selrtn = select(select_ev->maxfd+1, &r_fds, &w_fds, NULL, tvalp);
+ select_errno = errno;
tevent_trace_point_callback(select_ev->ev, TEVENT_TRACE_AFTER_WAIT);
- if (selrtn == -1 && errno == EINTR &&
+ if (selrtn == -1 && select_errno == EINTR &&
select_ev->ev->signal_events) {
tevent_common_check_signal(select_ev->ev);
return 0;
}
- if (selrtn == -1 && errno == EBADF) {
+ if (selrtn == -1 && select_errno == EBADF) {
/* the socket is dead! this should never
happen as the socket should have first been
made readable and that should have removed