From owner-svn-src-head@freebsd.org Sat Nov 21 22:11:12 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01F7DA34C41 for ; Sat, 21 Nov 2015 22:11:12 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A76D11086 for ; Sat, 21 Nov 2015 22:11:11 +0000 (UTC) (envelope-from mailing-machine@vniz.net) Received: by lbbkw15 with SMTP id kw15so78980263lbb.0 for ; Sat, 21 Nov 2015 14:11:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=y25wfgcfrdJ5Sf0LLuC3/DtWpXAWZvc2DkP8HBdieXQ=; b=hhRdwpwC2B/MaRguWUL2056xaqNpgszm7fKKp7YX4O7pPmR1Ldk7EbF08gPqmOfMTf WSOwsb3x+b+BLqI5Cq0zraWShJIy9X1prnbbHpavxuhRcegprY7B08XvmaT9UAEktmBD FpHHlR7kP3m/+k3EgEGkJ5kfDZWgmjPUszd/KItwq3OMkgkfdwHmblBzUOmYuDpET9Wo cfxBQ3QklRJ/cgzDgNrzTyns3wkbgBlRkYHzjV9WQdGZ5lkQSfwAmDiOnMVMFqIyjwZE NlXXKZZukTZOvFl0Pjg8wurFNI6X2J3I05mKsizAnSr4kdO5F00av/D2huJub+n+14ew mUbw== X-Gm-Message-State: ALoCoQmf/fX0Ayqv/+/SoWlLsTliaFbSjBGbqYYQ+qIkccPIUbKZ8D+EsrqxjnrmO+/qv5ABeQu+ X-Received: by 10.112.161.33 with SMTP id xp1mr6953772lbb.141.1448143869229; Sat, 21 Nov 2015 14:11:09 -0800 (PST) Received: from [192.168.1.2] ([89.169.173.68]) by smtp.gmail.com with ESMTPSA id xt2sm806935lbb.47.2015.11.21.14.11.07 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 21 Nov 2015 14:11:08 -0800 (PST) Subject: Re: svn commit: r291114 - head/lib/libc/gen To: David Sanderson References: <201511202236.tAKMaf06048447@repo.freebsd.org> <564FAAB0.6000600@freebsd.org> <28C3C55F-BF25-4DB2-AF05-B57F3F2CCAD5@panasas.com> <564FB5F3.1080301@freebsd.org> Cc: Ravi Pokala , Ravi Pokala , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, "Sanderson, David" From: Andrey Chernov Message-ID: <5650EBF9.9060002@freebsd.org> Date: Sun, 22 Nov 2015 01:11:05 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Nov 2015 22:11:12 -0000 On 21.11.2015 5:29, David Sanderson wrote: > Thank you for pointing out the possibility of fdopen() setting > FD_CLOEXEC on the parent's end of the pipe if the mode string contains > an 'e'. This is indeed documented on popen(3). > > However, note that popen() uses pipe2(pdes, O_CLOEXEC) to create the > pipe -- so both ends of the pipe start out with FD_CLOEXEC set. > > If the caller uses popen() with "re" or "we", the fdopen() code will > simply set FD_CLOEXEC on the parent's end of the pipe _again_. So > moving the fdopen() prior to the fork() doesn't have any net effect on > the file descriptors the child process receives, even in the face of > popen() with "re" or "we". > > Does this address your concerns? Yes, it is safe in this case. Thanx. -- http://ache.vniz.net/