diff options
author | Nathan Huff <nhuff@acm.org> | 2016-02-05 13:35:07 -0700 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2016-02-07 11:26:35 +0100 |
commit | 4953b1f73f8ec9387516be1058434d71937e1447 (patch) | |
tree | 3f9b740758ccedf7368a7adbdec42a792479170b | |
parent | 1f6495b2f5e49e25176f97ef9aa7516403db91d6 (diff) | |
download | samba-4953b1f73f8ec9387516be1058434d71937e1447.tar.gz |
Fix ETIME handling for Solaris event ports.
It is possible for port_getn to return -1 with errno set to ETIME and
still return events. If those events aren't processed the association is
lost by samba since the kernel dissacociated them and samba never
processed them so never reassociated them with the event port. The
patch checks the nget return value in the case of ETIME and if it is non
0 it doesn't return and goes through the event processing loop.
Signed-off-by: Nathan Huff <nhuff@acm.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Sun Feb 7 11:26:35 CET 2016 on sn-devel-144
-rw-r--r-- | lib/tevent/tevent_port.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/lib/tevent/tevent_port.c b/lib/tevent/tevent_port.c index 5b487d7341e..4b524dff291 100644 --- a/lib/tevent/tevent_port.c +++ b/lib/tevent/tevent_port.c @@ -496,10 +496,24 @@ static int port_event_loop(struct port_event_context *port_ev, struct timeval *t 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 && port_errno == ETIME) { + /* + * If errno is set to ETIME it is possible that we still got an event. + * In that case we need to go through the processing loop so that we + * reassociate the received event with the port or the association will + * be lost so check the value of nget is 0 before returning. + */ + if (nget == 0) { + /* we don't care about a possible delay here */ + tevent_common_loop_timer_delay(ev); + return 0; + } + /* + * Set the return value to 0 since we do not actually have an error and we + * do have events that need to be processed. This keeps us from getting + * caught in the generic error test. + */ + ret = 0; } if (ret == -1) { |