[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: propsal: all daemons should chdir / on startup



Package: manpages-dev
Version: 1.17-3

In article <[🔎] 87zpjcs9el.fsf@1Cust60.max37.los-angeles.ca.ms.uu.net> you wrote:
> Topi Miettinen <Topi.Miettinen@ml.tele.fi> writes:
>> open("/dev/null", O_RDWR); 
>> open("/dev/null", O_RDWR);
>> open("/dev/null", O_RDWR);
>> 
>> for fake std{in,out,err}

> Presumably the daemon isn't using stdin, stdout, and stderr, so you
> don't need to do this.  And you're not guaranteed to get the lowest
> fd, even though you probably will.  You should use dup/dup2 to get
> specific fds.

Oh yes open does guarantee the lowest file descriptor.  Someone should modify
our open(2) to reflect this.  In fact, I'm filing a bug report about this right
now.

-- 
Debian GNU/Linux 1.3 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Reply to: