]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - cups/request.c
Import CUPS v1.7.1
[thirdparty/cups.git] / cups / request.c
index 5b0559dc7f1519639b4198c71b70917f318473d0..817169b6a79b9021562eca8f9fc41ec6a184a295 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: request.c 7946 2008-09-16 23:27:54Z mike $"
+ * "$Id: request.c 11174 2013-07-23 12:33:52Z msweet $"
  *
  *   IPP utilities for CUPS.
  *
@@ -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 */
       {
        /*
@@ -1176,5 +1177,5 @@ _cupsSetHTTPError(http_status_t status)   /* I - HTTP status code */
 
 
 /*
- * End of "$Id: request.c 7946 2008-09-16 23:27:54Z mike $".
+ * End of "$Id: request.c 11174 2013-07-23 12:33:52Z msweet $".
  */