apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41975] New: - retry accept() when errno == EINTR
Date Wed, 28 Mar 2007 19:35:29 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41975>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41975

           Summary: retry accept() when errno == EINTR
           Product: APR
           Version: 1.2.7
          Platform: Other
        OS/Version: OpenBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
        AssignedTo: bugs@apr.apache.org
        ReportedBy: truk@optonline.net


Posix states accept() can return -1 with errno == EINTR.

http://www.opengroup.org/onlinepubs/009695399/functions/accept.html

In some implementations of posix threads this can happen and should be retried 
instead of failing.

--- network_io/unix/sockets.c.orig      Thu Dec  8 12:24:36 2005
+++ network_io/unix/sockets.c   Wed Mar 28 15:26:44 2007
@@ -184,9 +184,11 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr
 #endif
     (*new)->timeout = -1;

-    (*new)->socketdes = accept(sock->socketdes,
-                               (struct sockaddr *)&(*new)->remote_addr->sa,
-                               &(*new)->remote_addr->salen);
+    do {
+        (*new)->socketdes = accept(sock->socketdes,
+                                   (struct sockaddr 
*)&(*new)->remote_addr->sa,
+                                   &(*new)->remote_addr->salen);
+    } while ((*new)->socketdes == -1 && errno == EINTR);

     if ((*new)->socketdes < 0) {
         return errno;

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message