diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2002-05-24 07:28:44 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2002-05-24 07:28:44 +0000 |
commit | 68172295d4d04c206f01fc4865dd5c41f84726dd (patch) | |
tree | 0c3e74814d7e15a0ade8b1fd8cec24755336a9c4 /socket.c | |
parent | b125c5066a96955b35e8d5419f5820c0459f28aa (diff) | |
download | fetchmail-68172295d4d04c206f01fc4865dd5c41f84726dd.tar.gz fetchmail-68172295d4d04c206f01fc4865dd5c41f84726dd.tar.bz2 fetchmail-68172295d4d04c206f01fc4865dd5c41f84726dd.zip |
Cygwin port patch.
svn path=/trunk/; revision=3617
Diffstat (limited to 'socket.c')
-rw-r--r-- | socket.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -536,7 +536,7 @@ int SockWrite(int sock, char *buf, int len) int SockRead(int sock, char *buf, int len) { char *newline, *bp = buf; - int n; + int n, n2; #ifdef SSL_ENABLE SSL *ssl; #endif @@ -627,8 +627,25 @@ int SockRead(int sock, char *buf, int len) if ((newline = memchr(bp, '\n', n)) != NULL) n = newline - bp + 1; #ifndef __BEOS__ - if ((n = fm_read(sock, bp, n)) == -1) + if ((n2 = fm_read(sock, bp, n)) == -1) return(-1); +#ifdef __CYGWIN__ + /* + * Workaround Microsoft Winsock recv/WSARecv(..., MSG_PEEK) bug. + * See http://sources.redhat.com/ml/cygwin/2001-08/msg00628.html + * for more details. + */ + if (n2 != n) { + int n3; + if (outlevel >= O_VERBOSE) + report(stdout, GT_("Cygwin socket read retry\n")); + n3 = fm_read(sock, bp + n2, n - n2); + if (n3 == -1 || n2 + n3 != n) { + report(stderr, GT_("Cygwin socket read retry failed!\n")); + return(-1); + } + } +#endif /* __CYGWIN__ */ #endif /* __BEOS__ */ #endif bp += n; |