From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 63308 invoked by alias); 31 Aug 2016 22:08:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 63291 invoked by uid 89); 31 Aug 2016 22:08:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS,URIBL_RED autolearn=ham version=3.3.2 spammy=fcntl, late X-HELO: relay1.mentorg.com Date: Wed, 31 Aug 2016 22:08:00 -0000 From: Joseph Myers To: Rasmus Villemoes CC: , Adhemerval Zanella Subject: Re: [PATCH v2 3/3] posix: New Linux posix_spawn{p} implementation In-Reply-To: <87mvjsprqb.fsf@rasmusvillemoes.dk> Message-ID: References: <1454343665-1706-1-git-send-email-adhemerval.zanella@linaro.org> <1454343665-1706-4-git-send-email-adhemerval.zanella@linaro.org> <87mvjsprqb.fsf@rasmusvillemoes.dk> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) X-SW-Source: 2016-08/txt/msg00936.txt.bz2 On Wed, 31 Aug 2016, Rasmus Villemoes wrote: > Rather late to the party, but I think there's a few bugs here. Most > importantly, dup() doesn't preserve the CLOEXEC flag, so if we do move > the write end around like this, the fd will not automatically be closed > during the exec, and hence the parent won't receive EOF and will block > in read() call until the child finally exits. That's easily fixable with > fcntl(p, F_DUPFD_CLOEXEC, 0). Pretty annoying to add a test for, though. In Linux-specific code we can assume the presence of dup3 (which needs to be called by the name __dup3 in implementations of POSIX functions). -- Joseph S. Myers joseph@codesourcery.com