Module Name:    src
Committed By:   christos
Date:           Mon Aug 22 16:08:51 UTC 2016

Modified Files:
        src/usr.sbin/nfsd: nfsd.c

Log Message:
PR/51437: Hauke Fath: write a byte to the socket so that nfsd -u does not die.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/nfsd/nfsd.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/nfsd/nfsd.c
diff -u src/usr.sbin/nfsd/nfsd.c:1.66 src/usr.sbin/nfsd/nfsd.c:1.67
--- src/usr.sbin/nfsd/nfsd.c:1.66	Thu Mar 17 11:25:46 2016
+++ src/usr.sbin/nfsd/nfsd.c	Mon Aug 22 12:08:51 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfsd.c,v 1.66 2016/03/17 15:25:46 christos Exp $	*/
+/*	$NetBSD: nfsd.c,v 1.67 2016/08/22 16:08:51 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 19
 #if 0
 static char sccsid[] = "@(#)nfsd.c	8.9 (Berkeley) 3/29/95";
 #else
-__RCSID("$NetBSD: nfsd.c,v 1.66 2016/03/17 15:25:46 christos Exp $");
+__RCSID("$NetBSD: nfsd.c,v 1.67 2016/08/22 16:08:51 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -323,13 +323,14 @@ daemon2_fork(void)
 	 pid = fork();
 	 switch (pid) {
 	 case -1:
-		 return -1;
+		return -1;
 	 case 0:
-		 /* child */
-		 (void)close(detach_msg_pipe[0]);
+		/* child */
+		(void)close(detach_msg_pipe[0]);
+		(void)write(detach_msg_pipe[1], "", 1);
 		 return detach_msg_pipe[1];
 	 default:
-		 break;
+		break;
 	}
 
 	/* Parent */
@@ -497,6 +498,8 @@ main(int argc, char *argv[])
 
 	if (debug == 0) {
 		parent_fd = daemon2_fork();
+		if (parent_fd == -1)
+			logit(LOG_ERR, "daemon2_fork failed");
 		openlog("nfsd", LOG_PID, LOG_DAEMON);
 	}
 

Reply via email to