From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sukadev Bhattiprolu Subject: Re: bash: Correct usage of F_SETFD Date: Tue, 23 Nov 2010 09:51:57 -0800 Message-ID: <20101123175157.GA8230@us.ibm.com> References: <20101122201620.GA16687@us.ibm.com> <101122221640.AA32947.SM@caleb.INS.CWRU.Edu> <4CEAEE3A.4090004@redhat.com> <20101123000446.GA24667@us.ibm.com> <20101123144239.GL6178@parisc-linux.org> <4CEBD50E.7050405@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, chet.ramey@case.edu, bug-bash@gnu.org, chet@po.cwru.edu, Matthew Wilcox To: Eric Blake Return-path: Content-Disposition: inline In-Reply-To: <4CEBD50E.7050405@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: bug-bash-bounces+gnu-bug-bash-2=m.gmane.org@gnu.org Errors-To: bug-bash-bounces+gnu-bug-bash-2=m.gmane.org@gnu.org List-Id: linux-fsdevel.vger.kernel.org Eric Blake [eblake@redhat.com] wrote: | > | > So if bash is the one creating its file descriptors, there's no need to | > use R/M/W since it knows what the state of them are. | | No, bash cannot reasonably know what the implementation's default bit | state is, and blindly setting all other bits to zero is very possibly a | bug, and easy enough to avoid by using the full R/M/W. Besides, if user sets a flag on the fd and execs bash, bash would clobber the flag. IOW, assuming that bash is the one creating the fd is not always safe right ? Thanks, Sukadev