From 73df47bd455c09e52421a869f6cb1678f299d3fc Mon Sep 17 00:00:00 2001 From: Nathan Huff Date: Wed, 3 Feb 2016 13:06:52 -0700 Subject: [PATCH] Handle ETIME and EINTR handling for solaris event ports. It is quite possible to get a return of -1 and a errno of ETIME from port_getn and also get an event returned. The attached patch checks for the number of events returned and if it isn't 0 it falls through to the event handling code. If you don't do this Samba loses file descriptor associations since the kernel has dissociated the fd from the event port and Samba doesn't process the event and reassociate it. Signed-off-by: Nathan Huff Reviewed-by: Jeremy Allison --- lib/tevent/tevent_port.c | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/tevent/tevent_port.c b/lib/tevent/tevent_port.c index 5b487d7..d92bfce 100644 --- a/lib/tevent/tevent_port.c +++ b/lib/tevent/tevent_port.c @@ -484,29 +484,29 @@ static int port_event_loop(struct port_event_context *port_ev, struct timeval *t port_errno = errno; tevent_trace_point_callback(ev, TEVENT_TRACE_AFTER_WAIT); - if (ret == -1 && port_errno == EINTR) { - if (ev->signal_events) { - tevent_common_check_signal(ev); - } - /* - * If no signal handlers we got an unsolicited - * signal wakeup. This can happen with epoll - * too. Just return and ignore. - */ - return 0; - } - - if (ret == -1 && port_errno == ETIME && tvalp) { - /* we don't care about a possible delay here */ - tevent_common_loop_timer_delay(ev); - return 0; - } - if (ret == -1) { - tevent_debug(ev, TEVENT_DEBUG_ERROR, - "port_get failed (%s)\n", - strerror(errno)); - return -1; + if (port_errno == EINTR) { + if (ev->signal_events) { + tevent_common_check_signal(ev); + } + /* + * If no signal handlers we got an unsolicited + * signal wakeup. This can happen with epoll + * too. Just return and ignore. + */ + return 0; + } else if (port_errno == ETIME) { + if (nget == 0 && tvalp) { + /* we don't care about a possible delay here */ + tevent_common_loop_timer_delay(ev); + return 0; + } + } else { + tevent_debug(ev, TEVENT_DEBUG_ERROR, + "port_get failed (%s)\n", + strerror(errno)); + return -1; + } } for (i = 0; i < nget; i++) { -- 2.7.0.rc3.207.g0ac5344