-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
suppres SIGHUP on forking #25
base: master
Are you sure you want to change the base?
Conversation
Maxim Zakharov [email protected] writes:
Would it? I'm surprised. If so, we have a problem: the caller might expect a SIGHUP and hope to Cheers, |
But if the caller to do not expect it default action for SIGHUP is to terminate the process. glibc's implementation of daemon() doesn't not block SIGHUP, while freebsd's does: https://svnweb.freebsd.org/base/stable/9/lib/libc/gen/daemon.c?view=markup Also both versions call setsid() straight after fork(), so if you decide not to block SIGHUP it makes sense to move setsid() call up after fork() as it insulates of receiving SIGHUP from control terminal once executed. |
On Thu, Jul 30, 2015 at 05:57:40PM -0700, Maxim Zakharov wrote:
Are you saying that moving the setsid() prevents the SIGHUP? If so, David Gibson | I'll have my music baroque, and my code |
Moving setsid() set the possibility of SIGHUP to a minimum, but not prevents it completely. |
Maxim Zakharov [email protected] writes:
Ah, I see! So, if the parent is already the session group leader, then it will My complaint with your version since it might miss a real SIGHUP. Most (This is untested, but gives the idea...) Cheers, diff --git a/ccan/daemonize/daemonize.c b/ccan/daemonize/daemonize.c
/* Don't hold files open. /
|
We need to suppress SIGHUP until we set up as the parent's exit on forking would throw it.