diff options
author | Jeff Trawick <trawick@apache.org> | 2009-11-14 02:27:21 +0000 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2009-11-14 02:27:21 +0000 |
commit | a8cae693ead1a0742bb2a626aead495aed01cfcd (patch) | |
tree | a95fa91147866e0595cf614e6bc0834b5893820b /poll | |
parent | 69b58f78e337d669fae2663d0392ae35559bfc23 (diff) | |
download | apr-a8cae693ead1a0742bb2a626aead495aed01cfcd.tar.gz |
merge r836091 from trunk:
Check that an event was actually filled in when
port_getn() returns -1/EINTR with nget > 0.
This resolves a crash when receiving a signal.
PR: 48030
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.4.x@836098 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poll')
-rw-r--r-- | poll/unix/port.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/poll/unix/port.c b/poll/unix/port.c index a4509ac8a..7a31c4683 100644 --- a/poll/unix/port.c +++ b/poll/unix/port.c @@ -103,6 +103,10 @@ static apr_status_t call_port_getn(int port, port_event_t list[], tvptr = &tv; } + list[0].portev_user = (void *)-1; /* so we can double check that an + * event was returned + */ + ret = port_getn(port, list, max, nget, tvptr); /* Note: 32-bit port_getn() on Solaris 10 x86 returns large negative * values instead of 0 when returning immediately. @@ -114,10 +118,12 @@ static apr_status_t call_port_getn(int port, port_event_t list[], switch(rv) { case EINTR: case ETIME: - if (*nget > 0) { + if (*nget > 0 && list[0].portev_user != (void *)-1) { /* This confusing API can return an event at the same time * that it reports EINTR or ETIME. If that occurs, just - * report the event. + * report the event. With EINTR, nget can be > 0 without + * any event, so check that portev_user was filled in. + * * (Maybe it will be simplified; see thread * http://mail.opensolaris.org * /pipermail/networking-discuss/2009-August/011979.html |