summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tevent/tevent_epoll.c6
-rw-r--r--lib/tevent/tevent_poll.c4
-rw-r--r--lib/tevent/tevent_select.c6
3 files changed, 11 insertions, 5 deletions
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index 61a8525d2b..99d4806db0 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -313,6 +313,7 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
#define MAXEVENTS 1
struct epoll_event events[MAXEVENTS];
int timeout = -1;
+ int wait_errno;
if (epoll_ev->epoll_fd == -1) return -1;
@@ -328,15 +329,16 @@ static int epoll_event_loop(struct epoll_event_context *epoll_ev, struct timeval
tevent_trace_point_callback(epoll_ev->ev, TEVENT_TRACE_BEFORE_WAIT);
ret = epoll_wait(epoll_ev->epoll_fd, events, MAXEVENTS, timeout);
+ wait_errno = errno;
tevent_trace_point_callback(epoll_ev->ev, TEVENT_TRACE_AFTER_WAIT);
- if (ret == -1 && errno == EINTR && epoll_ev->ev->signal_events) {
+ if (ret == -1 && wait_errno == EINTR && epoll_ev->ev->signal_events) {
if (tevent_common_check_signal(epoll_ev->ev)) {
return 0;
}
}
- if (ret == -1 && errno != EINTR) {
+ if (ret == -1 && wait_errno != EINTR) {
epoll_panic(epoll_ev, "epoll_wait() failed", true);
return -1;
}
diff --git a/lib/tevent/tevent_poll.c b/lib/tevent/tevent_poll.c
index 89b3bbc0b3..81a7176f8e 100644
--- a/lib/tevent/tevent_poll.c
+++ b/lib/tevent/tevent_poll.c
@@ -444,6 +444,7 @@ static int poll_event_loop_poll(struct tevent_context *ev,
int timeout = -1;
unsigned first_fd;
unsigned i;
+ int poll_errno;
if (ev->signal_events && tevent_common_check_signal(ev)) {
return 0;
@@ -462,9 +463,10 @@ static int poll_event_loop_poll(struct tevent_context *ev,
tevent_trace_point_callback(poll_ev->ev, TEVENT_TRACE_BEFORE_WAIT);
pollrtn = poll(poll_ev->fds, poll_ev->num_fds, timeout);
+ poll_errno = errno;
tevent_trace_point_callback(poll_ev->ev, TEVENT_TRACE_AFTER_WAIT);
- if (pollrtn == -1 && errno == EINTR && ev->signal_events) {
+ if (pollrtn == -1 && poll_errno == EINTR && ev->signal_events) {
tevent_common_check_signal(ev);
return 0;
}
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