[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua bug - loadfile gets stdin confused
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 18 Apr 2007 20:48:30 -0300
> 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 problem. As far I can see,
there is no reliable way to tell whether a FILE* or fileno corresponds to
the original stdin that was open when the process started.