Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: File descriptor madness
- X-seq: zsh-workers 17118
- From: Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx (Zsh hackers list)
- Subject: Re: File descriptor madness
- Date: Thu, 09 May 2002 19:57:09 +0100
- In-reply-to: "Bart Schaefer"'s message of "Thu, 09 May 2002 12:08:27 PDT." <Pine.LNX.4.44.0205091149330.7898-100000@xxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
Bart Schaefer wrote:
> On Thu, 9 May 2002, Peter Stephenson wrote:
>
> > In this case it's tying up fd 3, right in the paltry set of 9 fd's we
> > have available. [...]
> > One solution to this problem is to open (or dup something such as fd 0
> > onto) all fd's 3 to 9 during initialisation and then close them again
> > before any user code is executed
>
> It'd have to be an actual open() or the equivalent, because there's no way
> to guarantee that any particular descriptor (even 0) is valid when the
> shell starts up.
Apart from 0, which I suppose we need to test with open(), I had in mind
just using dup() to dup 0 and see where the fd ended up. This would in
one go show open fd's (avoided) and open new fd's to block them. Or
doesn't that work?
--
Peter Stephenson <pws@xxxxxxxxxxxxxxxxxxxxxxxx>
Work: pws@xxxxxxx
Web: http://www.pwstephenson.fsnet.co.uk
Messages sorted by:
Reverse Date,
Date,
Thread,
Author