From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19277 invoked by alias); 29 Apr 2002 11:57:22 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 19252 invoked from network); 29 Apr 2002 11:57:17 -0000 Received: from unknown (HELO smtp.comcast.net) (24.153.64.2) by sources.redhat.com with SMTP; 29 Apr 2002 11:57:17 -0000 Received: from althea.tishler.net (bgp572446bgs.eatntn01.nj.comcast.net [68.39.6.197]) by mtaout03.icomcast.net (iPlanet Messaging Server 5.1 HotFix 0.3 (built Apr 8 2002)) with SMTP id <0GVB000GLVVG4H@mtaout03.icomcast.net> for cygwin@cygwin.com; Mon, 29 Apr 2002 07:57:16 -0400 (EDT) Received: by althea.tishler.net (sSMTP sendmail emulation); Mon, 29 Apr 2002 08:03:47 -0400 Date: Mon, 29 Apr 2002 05:39:00 -0000 From: Jason Tishler Subject: Cygwin Winsock recv/WSARecv(..., MSG_PEEK) patch To: fetchmail-friends@lists.ccil.org Cc: Cygwin Mail-followup-to: fetchmail-friends@lists.ccil.org, Cygwin Message-id: <20020429120347.GA1152@tishler.net> MIME-version: 1.0 Content-type: multipart/mixed; boundary="Boundary_(ID_KKQrmcGTH2hZEQ9w70dNnQ)" User-Agent: Mutt/1.3.24i X-SW-Source: 2002-04/txt/msg01587.txt.bz2 --Boundary_(ID_KKQrmcGTH2hZEQ9w70dNnQ) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline Content-length: 1134 Eric, Attached is a patch (against fetchmail 5.9.11) that works around the Microsoft Winsock recv/WSARecv(..., MSG_PEEK) problem that I originally post to fetchmail-friends in: http://lists.ccil.org/pipermail/fetchmail-friends/2001-August/000906.html This patch is essentially the same as the one that I posted in: http://www.cygwin.com/ml/cygwin/2001-08/msg00628.html but cleaned up as follows: o Cygwin specific code is guarded by conditional compilation o log messages use report() instead of printf() o log messages respect the --silent/--verbose options Would you consider accepting this patch into fetchmail CVS? Note the following: o Unfortunately, this problem cannot be fixed or worked around in the Cygwin DLL itself. o I have tested this patch under Red Hat Linux 7.1 without any ill effects. o I intend to become the Cygwin fetchmail (and procmail) maintainer and will be contributing pre-built fetchmail (and procmail) tarballs to the standard Cygwin distribution. BTW, please CC me since I am not subscribed to the fetchmail-friends list. Thanks, Jason --Boundary_(ID_KKQrmcGTH2hZEQ9w70dNnQ) Content-type: text/plain; charset=us-ascii; NAME=fetchmail.patch Content-transfer-encoding: 7BIT Content-disposition: attachment; filename=fetchmail.patch Content-length: 1087 --- socket.c.orig Mon Apr 1 03:16:35 2002 +++ socket.c Fri Apr 26 15:45:55 2002 @@ -536,7 +536,7 @@ int SockWrite(int sock, char *buf, int l 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 le 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; --Boundary_(ID_KKQrmcGTH2hZEQ9w70dNnQ) Content-Type: text/plain; charset=us-ascii Content-length: 214 -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/ --Boundary_(ID_KKQrmcGTH2hZEQ9w70dNnQ)--