lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I just went through the original bug reports for Lua 5.1.2 and
this one from David Manura caught my attention:

Ok, so stdin/stdout/stderr can no longer be closed from Lua code.
This is probably a good idea, anyway. Alas, this makes it hard to
reproduce the problem, but doesn't cure the bug itself.

E.g. stdin may have been closed from C code or may not be open to
begin with (for daemon processes, though it's customary to
freopen() to /dev/null to avoid these kind of problems).

The next opened FILE * may then use the stdin slot. E.g. MSVCRT
suffers from this problem, glibc doesn't, don't know for others.
In this case loadfile() may refuse to load binary chunks and/or
never close the file descriptor.

One possible fix has been posted by Mark Edgar: