Subject: Re: Warning message: Why do I care?
To: None <ww@styx.org>
From: Steven M. Bellovin <smb@research.att.com>
List: current-users
Date: 08/01/2002 14:02:34
In message <20020801135402.K2158@styx.org>, ww@styx.org writes:
>On Thu, Aug 01, 2002 at 12:34:07PM -0400, John Franklin wrote:
>>
>> I disagree. Too much software treats fd 0-2 as sacred. I don't think
>> that open(2) should ever return a fd below 3. I don't belive this would
>> break anything.
>
>how would you redirect output to a file then? usually this
>is implemented with something like
>
> close(1);
> fd = open("somefile", O_WRONLY);
>
>-w
>
You could use dup2(). But I suspect there's a lot of code around that
does it your way.
--Steve Bellovin, http://www.research.att.com/~smb (me)
http://www.wilyhacker.com ("Firewalls" book)