[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua bug - loadfile gets stdin confused
- From: Roberto Waltman <r5000@...>
- Date: Wed, 18 Apr 2007 20:15:34 -0400
Luiz Henrique de Figueiredo wrote:
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.
Not probably - File descriptors are assigned starting with the
smallest available. Closing stdin and immediately opening a new
file is guaranteed to use file descriptor 0.