[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:39:22 +0200
Rob Kendrick <firstname.lastname@example.org> writes:
> On Wed, 2007-04-18 at 15:19 -0300, Roberto Ierusalimschy wrote:
>> > Reading between the lines, the standard is pretty clear that
>> > continuing to operate on a FILE after calling fclose() is not
>> > valid. Effectively, continued use of a FILE* after calling
>> > fclose() is similar to continued use a malloc()ed pointer after
>> > calling free(). You might get lucky, but that doesn't make it valid.
>> That is true. Perhaps the best solution to all these problems would be
>> to prohibit Lua from closing a standard file (stdin/stdout/stderr).
>> Older versions of Lua had this restriction, I cannot remember why
>> we lifted it.
> Closing, or at least re-opening to /dev/null or similar, the standard
> file handles is essential if you're writing a daemon that chroots and
> drops privileges, otherwise you had FDs open as root.
FDs open as root? What is that supposed to mean? The problem is
rather one of detaching from the process group of the tty, I think.