Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Date: Wed, 26 Mar 2003 09:52:21 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Failed non-blocking connect returns incorrect errno on AF_UNIX protocol
Message-ID: <20030326085220.GQ23762@cygbert.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <3E80F8E1.2000409@linuxforum.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <3E80F8E1.2000409@linuxforum.net>
User-Agent: Mutt/1.4i

On Wed, Mar 26, 2003 at 08:48:33AM +0800, David Huang wrote:
> Failed non-blocking connect returns incorrect errno on AF_UNIX protocol.
> See attached test program.
> 
> On cygwin:
> $ ./afunix
> EINPROGRESS: Operation now in progress
> 
> On
> Linux 2.4 (Debian 2.2)
> Linux 2.4 (Redhat 7.3)
> Sun Solaris (8):
> $ ./afunix
> ECONNREFUSED: Connection refused
> 
> When i comment following code:
> //	if (fcntl (fd2, F_SETFL, O_NONBLOCK) < 0)
> //		printf ("Failed to set fd non-blocking");
> The result is
> ECONNREFUSED: Connection refused
> 
> It seems an old bug.
> I don't know whether it effect others address/protocol families.

I don't see that it's an error.  On non-blocking sockets you have to
expect that connect() returns before being connected.  Just because
other systems are so quick figuring out that nothing is listening on
the other side, this doesn't invalidate the EINPROGRESS response under,
well, slower conditions.

And, btw., SUSv3 doesn't say a word that EINPROGRESS is not a valid
response for AF_LOCAL sockets.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.

--
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/

