[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua bug - loadfile gets stdin confused
- From: David Kastrup <dak@...>
- Date: Thu, 19 Apr 2007 08:45:17 +0200
Luiz Henrique de Figueiredo <firstname.lastname@example.org> writes:
>> For windows:
>> _get_osfhandle(_fileno(stdout)) > 0
>> means valid.
> Unix has fileno, but if stdio is recycling FILE* then it probably is
> also recycling filenos. So opening a file right after closing stdin
> will probably create a file whose fileno is 0. That's the whole
It is actually an old idiom in Unix to close those file descriptors
and expect them to open from the beginning. It predates doing this by
dup2 and similar calls.