[Bug libc/19144] daemon() fails to prevent reacquisition of controlling terminal
mtk.manpages at gmail dot com
sourceware-bugzilla@sourceware.org
Fri Dec 4 19:29:00 GMT 2015
https://sourceware.org/bugzilla/show_bug.cgi?id=19144
--- Comment #2 from Michael Kerrisk <mtk.manpages at gmail dot com> ---
Hi FLorian,
(In reply to Florian Weimer from comment #1)
> How risky is adding the second fork? Would it otherwise change behavior?
Well:
* It would fix the bug that allows the caller to reacquire a controlling
terminal. It seems unlikely that any program would depend on that bug in order
to acquire a controlling tty.
* In a properly constructed System-V type daemon, the resulting process is
neither a session leader (which is the critical point) nor a process group
leader. This means (getpid() != getsid() && getpid() != getpgrp()). But with
the baemon(3) in glibc, the following is true for the resulting process:
(getpid() == getsid() && getpid() == getpgrp()). It seems rather unlikely that
any program would depend on this fact though.
> By the way, the manual daemon(3) manual page talks about the “calling
> process's current working directory”. I think this is misleading because
> the function exits the calling process before changing the current directory.
I changed "calling process's" to "processes".
Cheers,
Michael
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list