]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Closed server connections were still not always detected
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 23 Jul 2013 12:33:52 +0000 (12:33 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 23 Jul 2013 12:33:52 +0000 (12:33 +0000)
(<rdar://problem/14484313>)

- Also need to check for EOF from recv...

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@11174 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES-1.6.txt
cups/request.c

index 96da1a537ebd2b8893371c1de3968d30ebf05428..c224ca0cd2bcb24ff4da4e5303ac88ac2bbca88f 100644 (file)
@@ -3,6 +3,8 @@ CHANGES-1.6.txt
 
 CHANGES IN CUPS V1.6.4
 
+       - Closed server connections were still not always detected
+         (<rdar://problem/14484313>)
        - The libusb-based USB backend now loads its list of quirks from files
          in /usr/share/cups/usb instead of using a hardcoded table
          (<rdar://problem/14442769>)
index 9f0995ba308fbc72aac16c9213858956d4549358..0ccb4996560df6001aed910fc94b1a87b76ae729 100644 (file)
@@ -1017,14 +1017,15 @@ _cupsConnect(void)
       * Same server, see if the connection is still established...
       */
 
-      char ch;                         /* Connection check byte */
+      char     ch;                     /* Connection check byte */
+      ssize_t  n;                      /* Number of bytes */
 
 #ifdef WIN32
-      if (recv(cg->http->fd, &ch, 1, MSG_PEEK) < 0 &&
-          WSAGetLastError() != WSAEWOULDBLOCK)
+      if ((n = recv(cg->http->fd, &ch, 1, MSG_PEEK)) == 0 ||
+          (n < 0 && WSAGetLastError() != WSAEWOULDBLOCK))
 #else
-      if (recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) < 0 &&
-          errno != EWOULDBLOCK)
+      if ((n = recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT)) == 0 ||
+          (n < 0 && errno != EWOULDBLOCK))
 #endif /* WIN32 */
       {
        /*