Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 8 Sep 2004 12:06:57 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: win95 pipe problems -- report + testcase + patch (was: Re: [ANNOUNCEMENT] Updated: cygwin-1.5.11-1) Message-ID: <20040908100657.GC20537@cygbert.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <200409050451 DOT i854pPi21887 AT esds DOT vss DOT fsi DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i On Sep 8 01:55, Bas van Gompel wrote: > This fix trips on a bug in (my) windows 95 (OSR2): > It's CreateNamedPipe returns 0 instead of -1 (INVALID_HANDLE_VALUE), > causing all operations on pipes to fail. > [...] > A patch to work around this in cygwin could be: (WFM) > > ==== Begin pipe-w95.diff ==== > --- src/winsup/cygwin/pipe.cc 3 Sep 2004 01:32:02 -0000 1.62 > +++ src/winsup/cygwin/pipe.cc 7 Sep 2004 19:09:55 -0000 > @@ -259,6 +259,7 @@ create_selectable_pipe (PHANDLE read_pip > the pipe was not created earlier by some other process, even if > the pid has been reused. We avoid FILE_FLAG_FIRST_PIPE_INSTANCE > because that is only available for Win2k SP2 and WinXP. */ > + SetLastError(0); > read_pipe = CreateNamedPipe (pipename, > PIPE_ACCESS_INBOUND, > PIPE_TYPE_BYTE | PIPE_READMODE_BYTE, > @@ -268,13 +269,13 @@ create_selectable_pipe (PHANDLE read_pip > NMPWAIT_USE_DEFAULT_WAIT, > sa_ptr); > > - if (read_pipe != INVALID_HANDLE_VALUE) > + DWORD err = GetLastError (); > + if ((read_pipe || !err) && read_pipe != INVALID_HANDLE_VALUE) > { > debug_printf ("pipe read handle %p", read_pipe); > break; > } > > - DWORD err = GetLastError (); > switch (err) > { > case ERROR_PIPE_BUSY: > > ===== End pipe-w95.diff ===== > > I hope this patch is small enough to qualify as `trivial', as I It is. I'm just wondering if it is really necessary to assume, that CreateNamedPipe will ever return NULL as a vaild handle. I'd assume that the following patch is sufficient: --- pipe.cc.ORIG 2004-09-08 11:58:57.000000000 +0200 +++ pipe.cc 2004-09-08 11:59:05.000000000 +0200 @@ -268,7 +268,8 @@ create_selectable_pipe (PHANDLE read_pip NMPWAIT_USE_DEFAULT_WAIT, sa_ptr); - if (read_pipe != INVALID_HANDLE_VALUE) + /* Win 95 seems to return NULL instead of INVALID_HANDLE_VALUE */ + if (read_pipe && read_pipe != INVALID_HANDLE_VALUE) { debug_printf ("pipe read handle %p", read_pipe); break; > haven't received any reply to my legal query (yet). (Did the reply > get blocked from the list?) No, there was no reply so far, unfortunately. I'm sorry. I'll try to nudge our legal department again. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/