Thanks. I've also read the chapter about dup's from the Stevens book 
and realized, that you always have to check the fd number you're going 
to close() after a dup2()

But how can the argc be less than 1? When is it the case? After an exec()?

2005/8/22, Todd C. Miller <[EMAIL PROTECTED]>:
> Nope.  There is no guarantee that fds 0-2 are open when a program
> starts.  In that case, fd will fall in the range 0-2 and without
> the check we can close one of the descriptors 0-2.
> 
> Bonus trivia:  There's also no guarantee that argc > 0 when a program
> starts.  Lots of programs make bad assumptions...

Reply via email to