Module Name: src
Committed By: gson
Date: Fri Apr 4 12:45:59 UTC 2014
Modified Files:
src/usr.sbin/mountd: mountd.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.125 -r1.126 src/usr.sbin/mountd/mountd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/mountd/mountd.c
diff -u src/usr.sbin/mountd/mountd.c:1.125 src/usr.sbin/mountd/mountd.c:1.126
--- src/usr.sbin/mountd/mountd.c:1.125 Sat Oct 19 17:16:37 2013
+++ src/usr.sbin/mountd/mountd.c Fri Apr 4 12:45:59 2014
@@ -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, 19
#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);