Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/nfsd PR/51437: Hauke Fath: write a byte to the sock...



details:   https://anonhg.NetBSD.org/src/rev/a2e2d587c0f9
branches:  trunk
changeset: 817500:a2e2d587c0f9
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Aug 22 16:08:51 2016 +0000

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

diffstat:

 usr.sbin/nfsd/nfsd.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r 8822e61e4dc5 -r a2e2d587c0f9 usr.sbin/nfsd/nfsd.c
--- a/usr.sbin/nfsd/nfsd.c      Mon Aug 22 15:08:48 2016 +0000
+++ b/usr.sbin/nfsd/nfsd.c      Mon Aug 22 16:08:51 2016 +0000
@@ -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 @@
 #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 @@
         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 @@
 
        if (debug == 0) {
                parent_fd = daemon2_fork();
+               if (parent_fd == -1)
+                       logit(LOG_ERR, "daemon2_fork failed");
                openlog("nfsd", LOG_PID, LOG_DAEMON);
        }
 



Home | Main Index | Thread Index | Old Index