When daemonizing, delay the parent exit until the daemon is ready to
provide service. Fixes a race that is a third possible cause of PR misc/48282, in addition to the ones in rpc.rquotad and nfsd that were fixed earlier.
This commit is contained in:
parent
bfb81d5f44
commit
815d09e5bc
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mountd.c,v 1.125 2013/10/19 17:16:37 christos Exp $ */
|
||||
/* $NetBSD: mountd.c,v 1.126 2014/04/04 12:45:59 gson Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: mountd.c,v 1.125 2013/10/19 17:16:37 christos Exp $");
|
||||
__RCSID("$NetBSD: mountd.c,v 1.126 2014/04/04 12:45:59 gson Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -334,11 +334,6 @@ main(int argc, char **argv)
|
||||
get_mountlist();
|
||||
if (debug)
|
||||
(void)fprintf(stderr, "Here we go.\n");
|
||||
if (debug == 0) {
|
||||
daemon(0, 0);
|
||||
(void)signal(SIGINT, SIG_IGN);
|
||||
(void)signal(SIGQUIT, SIG_IGN);
|
||||
}
|
||||
(void)signal(SIGHUP, get_exportlist);
|
||||
(void)signal(SIGTERM, send_umntall);
|
||||
pidfile(NULL);
|
||||
@ -463,6 +458,11 @@ main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (debug == 0) {
|
||||
daemon(0, 0);
|
||||
(void)signal(SIGINT, SIG_IGN);
|
||||
(void)signal(SIGQUIT, SIG_IGN);
|
||||
}
|
||||
svc_run();
|
||||
syslog(LOG_ERR, "Mountd died");
|
||||
exit(1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user