Bugzilla bug #86941: worked around a TCP socket close() bug in Tru64
authorwtc%netscape.com
Wed, 20 Jun 2001 22:53:38 +0000
changeset 1963 ca75e46b43fb3ed20b91b0cf6b799a72cf03deb2
parent 1957 d0de3cbd7a052c315f4ddee750ede5021ee091f4
child 1964 d10357d4e2ff8f490605c1d30684717939f867b6
push idunknown
push userunknown
push dateunknown
bugs86941
Bugzilla bug #86941: worked around a TCP socket close() bug in Tru64 UNIX V5.1.
pr/src/pthreads/ptio.c
--- a/pr/src/pthreads/ptio.c
+++ b/pr/src/pthreads/ptio.c
@@ -1137,18 +1137,36 @@ static PRStatus pt_Close(PRFileDesc *fd)
         return PR_FAILURE;
     }
     if (pt_TestAbort()) return PR_FAILURE;
 
     if (_PR_FILEDESC_OPEN == fd->secret->state)
     {
         if (-1 == close(fd->secret->md.osfd))
         {
+#ifdef OSF1
+            /*
+             * Bug 86941: On Tru64 UNIX V5.0A and V5.1, the close()
+             * system call, when called to close a TCP socket, may
+             * return -1 with errno set to EINVAL but the system call
+             * does close the socket successfully.  An application
+             * may safely ignore the EINVAL error.  This bug is fixed
+             * on Tru64 UNIX V5.1A and later.  The defect tracking
+             * number is QAR 81431.
+             */
+            if (PR_DESC_SOCKET_TCP != fd->methods->file_type
+            || EINVAL != errno)
+            {
+                pt_MapError(_PR_MD_MAP_CLOSE_ERROR, errno);
+                return PR_FAILURE;
+            }
+#else
             pt_MapError(_PR_MD_MAP_CLOSE_ERROR, errno);
             return PR_FAILURE;
+#endif
         }
         fd->secret->state = _PR_FILEDESC_CLOSED;
     }
     _PR_Putfd(fd);
     return PR_SUCCESS;
 }  /* pt_Close */
 
 static PRInt32 pt_Read(PRFileDesc *fd, void *buf, PRInt32 amount)