delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/12/09/10:41:37

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 <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com, Enrico Forestieri <forenr AT lyx DOT org>
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 <forenr AT lyx DOT org>
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
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
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019