From: Martin Willi Date: Thu, 21 Nov 2013 15:27:50 +0000 (+0100) Subject: chunk: Fallback to recv() on Windows chunk_from_fd() when operating on socket X-Git-Tag: 5.2.0dr6~24^2~78 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=740404d48193dece09047608c7d8362c5a7536e8;p=thirdparty%2Fstrongswan.git chunk: Fallback to recv() on Windows chunk_from_fd() when operating on socket --- diff --git a/src/libstrongswan/utils/chunk.c b/src/libstrongswan/utils/chunk.c index dd84d5106c..7958931d06 100644 --- a/src/libstrongswan/utils/chunk.c +++ b/src/libstrongswan/utils/chunk.c @@ -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);