chunk: Fallback to recv() on Windows chunk_from_fd() when operating on socket

This commit is contained in:
Martin Willi
2014-06-04 15:53:04 +02:00
parent 9ff1716029
commit 740404d481
+6
View File
@@ -269,6 +269,12 @@ bool chunk_from_fd(int fd, chunk_t *out)
while (TRUE)
{
len = read(fd, buf + total, bufsize - total);
#ifdef WIN32
if (len == -1 && errno == EBADF)
{ /* operating on a Winsock socket? */
len = recv(fd, buf + total, bufsize - total, 0);
}
#endif
if (len < 0)
{
free(buf);