From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sukadev Bhattiprolu Subject: bash: Correct usage of F_SETFD Date: Mon, 22 Nov 2010 12:16:20 -0800 Message-ID: <20101122201620.GA16687@us.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: linux-fsdevel@vger.kernel.org, bug-bash@gnu.org Return-path: Received: from e31.co.us.ibm.com ([32.97.110.149]:57595 "EHLO e31.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757379Ab0KVUIo (ORCPT ); Mon, 22 Nov 2010 15:08:44 -0500 Received: from d03relay01.boulder.ibm.com (d03relay01.boulder.ibm.com [9.17.195.226]) by e31.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id oAMJtNUS012526 for ; Mon, 22 Nov 2010 12:55:23 -0700 Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by d03relay01.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id oAMK8bS4134248 for ; Mon, 22 Nov 2010 13:08:38 -0700 Received: from d03av03.boulder.ibm.com (loopback [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id oAMK8a4x009840 for ; Mon, 22 Nov 2010 13:08:37 -0700 Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: include/filecntl.h in bash-4.1 has following: #define SET_CLOSE_ON_EXEC(fd) (fcntl ((fd), F_SETFD, FD_CLOEXEC)) Is that really the correct/intended usage of F_SETFD ? If kernel ever adds a new flag to the fd, this would end up clearing the other new flag right ? Shouldn't bash use F_GETFD to get the current flags and set/clear just the FD_CLOEXEC bit ? Sukadev