Subject: Re: Warning message: Why do I care?
To: Ben Harris <bjh21@netbsd.org>
From: Greywolf <greywolf@starwolf.com>
List: current-users
Date: 08/02/2002 08:46:27
On Fri, 2 Aug 2002, Ben Harris wrote:

# In article <20020801183636.GH3946@deathmitten.example.org> you write:
# [ open() returning 0, 1 or 2 ]
# >If the standards say so, the standards say so.  I disagree with the
# >standard on this point, but I'll concede.
#
# As others have said, POSIX is quite clear on this point, and I don't think
# it'll change.
#
# OTOH, the POSIX definition of exec() is quite likely to change to allow
# implementations to re-open FDs 0, 1 and 2.  Up until 1003.1-2001, this is
# forbidden, but 1003.1-2001/Cor 1-200x will permit it for setuid or setgid
# executables, and a future revision might extend this to all executables.

Funny, I thought this sort of thing was what

	for (d=0;d<=2;d++) {
		close(d);
		open("/dev/null", O_RDWR);
		ioctl(d,FIONCLEX,0);
	}
	execl(...);

were for.

I don't think there's any business changing these semantics, myself.
Are we going to continue to dumb down the API so that programmers can
be lazier and less aware of what's going on?  I'll tell you right now
that anyone who designs to 1003.1-2001/Cor 1-200x will be in for a
large reality check when programming on a legacy system (where legacy
might be only a year out of date).

I'm sorry, am I *really* blowing smoke here?  Am I the only one who
is perceiving this sort of automagic fd mangling to be A Bad Thing?


				--*greywolf;
--
NetBSD: I Wanna Be Sedated!