apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r836111 - in /apr/apr/branches/1.3.x: CHANGES poll/unix/port.c
Date Sat, 14 Nov 2009 03:26:35 GMT
Author: trawick
Date: Sat Nov 14 03:26:34 2009
New Revision: 836111

URL: http://svn.apache.org/viewvc?rev=836111&view=rev
Log:
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

Modified:
    apr/apr/branches/1.3.x/CHANGES
    apr/apr/branches/1.3.x/poll/unix/port.c

Modified: apr/apr/branches/1.3.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/CHANGES?rev=836111&r1=836110&r2=836111&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.3.x/CHANGES [utf-8] Sat Nov 14 03:26:34 2009
@@ -5,6 +5,10 @@
      [Jeff Trawick]
 
   *) Solaris pollset support: Fix a 1.3.9 regression in apr_pollset_poll()
+     which could result in a crash when the call was interrupted by a
+     signal.  PR 48030.  [Jeff Trawick]
+
+  *) Solaris pollset support: Fix a 1.3.9 regression in apr_pollset_poll()
      which resulted in invalid return codes from the APR function.  A work-
      around was needed for bad return codes from 32-bit port_getn() on 
      Solaris 10 x86.  PR 48029.  [Jeff Trawick]

Modified: apr/apr/branches/1.3.x/poll/unix/port.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.3.x/poll/unix/port.c?rev=836111&r1=836110&r2=836111&view=diff
==============================================================================
--- apr/apr/branches/1.3.x/poll/unix/port.c (original)
+++ apr/apr/branches/1.3.x/poll/unix/port.c Sat Nov 14 03:26:34 2009
@@ -100,6 +100,10 @@
         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.
@@ -111,10 +115,12 @@
         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



Mime
View raw message