X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 9 Dec 2009 10:41:09 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com, Enrico Forestieri Subject: Re: open() and named pipes Message-ID: <20091209154108.GA3540@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com, Enrico Forestieri References: <20081126145052 DOT GB16542 AT sirio DOT sssup DOT it> <20081126173849 DOT GA14783 AT ednor DOT casa DOT cgf DOT cx> <20091209144340 DOT GA2916 AT GIOVE> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20091209144340.GA2916@GIOVE> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: 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 On Wed, Dec 09, 2009 at 03:43:41PM +0100, Enrico Forestieri wrote: >Sorry for the very late reply and thanks for fixing the return code >from open(). However, this is still not posix compliant as errno is >set to ENOENT instead of ENXIO. Indeed, the attached test case prints >"No process is reading from the other end." on both Linux and Solaris >but nothing on Cygwin. The patch below should fix this. I'll check it in as soon as the latest version of Cygwin is released. That should be imminent. cgf =================================================================== RCS file: /cvs/uberbaum/winsup/cygwin/fhandler_fifo.cc,v retrieving revision 1.36 diff -d -u -r1.36 fhandler_fifo.cc --- fhandler_fifo.cc 31 Oct 2009 13:24:06 -0000 1.36 +++ fhandler_fifo.cc 9 Dec 2009 15:39:54 -0000 @@ -76,6 +76,7 @@ { int res = 1; char npname[MAX_PATH]; + bool set_errno = true; fifo_name (npname); unsigned low_flags = flags & O_ACCMODE; @@ -110,7 +111,10 @@ if (h != INVALID_HANDLE_VALUE) wait_state = fifo_ok; else if (nonblocking_write) - set_errno (ENXIO); + { + set_errno (ENXIO); + set_errno = false; + } else if ((h = cnp (PIPE_ACCESS_DUPLEX, 1)) != INVALID_HANDLE_VALUE) { if ((dummy_client = open_nonserver (npname, low_flags, sa_buf)) @@ -130,7 +134,8 @@ } if (h == INVALID_HANDLE_VALUE) { - __seterrno (); + if (set_errno) + __seterrno (); res = 0; } else if (!setup_overlapped ()) -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple