[vdr] [RFC] Shutdown rewrite for 1.5.x
Udo Richter
udo_richter at gmx.de
Tue Jan 23 22:19:57 CET 2007
Marko Mäkelä wrote:
> The problem seems to lie in shutdown.c, in SystemExecSession().
> It won't close file descriptor 0, but it will close anything above
> STDERR_FILENO (which is normally 2). This function appears to show
> up in strace output as "clone()". Adding close(0) to the function
> fixes the problem. Do you see any reason why the shutdown script
> would need to access stdin? (I can see reasons why it would want to
> access stdout or stderr.)
Actually, the SystemExecSession() is just a modified version of
SystemExec() in thread.c, that was used before to call the shutdown
script. They only differ in the fact that VDR continues instead of
waiting for the child process, and that the child process is detached
into its own session. There's no serious difference regarding the file
handles.
Since the shutdown script runs in the background, the stdin could
probably be closed. After all, VDR should continue to 'own' stdin, and
running in the background would probably cause a conflict. However,
running the script with a closed file handle may cause other side effects.
Cheers,
Udo
More information about the vdr
mailing list