/*
- * "$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.
*
* 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 */
{
/*
/*
- * 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 $".
*/