Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: File descriptor madness



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