Subject: Re: fork(2) vs. pthread_create() (fwd)
To: None <tech-userlevel@NetBSD.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 06/11/2004 14:38:46
> The crux of the problem is how do you, in the library, know that fd 1
> or fd 2 actually go to stdout or stderr?
I must be confused, but I thought that fd 1 went to stdout and fd2 went
to stderr _by definition_ - that is, that stdout is defined to be
whatever fd 1 goes to (and stderr, fd 2).
> The fact that libraries sometimes output to stderr is actually a
> security issue. Consider a daemon that has hooked something other
> than stderr to fd 2.
"Don't do that, then." Quite aside from the use of "stderr" to refer
to something other than "that which fd 2 is connected to", such a
daemon is coded inappropriately for it to be used in a
security-sensitive way - or, to put it more bluntly, it's broken.
Libraries cannot make up for arbitrary levels of bustification in the
calling application, and I see no reason for them to try.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML firstname.lastname@example.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B