delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/18/02:48:28

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <077d01c1400e$2d92cdc0$d2823bd5@dmitry>
From: "Dmitry Timoshkov" <dmitry AT baikal DOT ru>
To: <cygwin AT cygwin DOT com>
Subject: fcntl(F_SETFD) on a file or socket handle
Date: Tue, 18 Sep 2001 15:48:22 +0900
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200

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.

--
Dmitry.


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

- Raw text -


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