Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Date: Tue, 18 Sep 2001 10:12:38 +0200
From: Corinna Vinschen <cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: fcntl(F_SETFD) on a file or socket handle
Message-ID: <20010918101238.H22900@cygbert.vinschen.de>
Mail-Followup-To: cygwin@cygwin.com
References: <077d01c1400e$2d92cdc0$d2823bd5@dmitry>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
In-Reply-To: <077d01c1400e$2d92cdc0$d2823bd5@dmitry>; from dmitry@baikal.ru on Tue, Sep 18, 2001 at 03:48:22PM +0900

On Tue, Sep 18, 2001 at 03:48:22PM +0900, Dmitry Timoshkov wrote:
> Hello.
> 
> Just want report a serious bug in Cygwin.
> 
> Many applications use this construct in their code:
> fcntl(fd, F_SETFD, 1); /* set close on exec flag */
> 
> fcntl(fd) below is a replacement for the above construct,
> fd - file/socket descriptor, resulted from an open() or a socket() call.
> 
> Some symptoms:
> 
> 1. If an fd is a socket and fcntl(fd) is called right after the connect(fd) call,
> connection will get broken.
> 
> 2. If an fd is transferred via a pipe end and fcntl(fd) is called right after
> write(pipe, &fd, sizeof(fd)) call, the another pipe end will receive an invalid
> fd handle.
> 
> If in the both cases above add sleep(1) before fcntl(fd), then all works without
> a failure.
> 
> I didn't investigate it further, and probably will not have time in the near
> future to do so. Sorry.

:-(

You could at least send a testcase if you don't want to debug it.

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/

