]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/gssd/svcgssd.c
NFS man page: update nfs(5) with details about IPv6 support
[nfs-utils.git] / utils / gssd / svcgssd.c
index 69d2a6966946b287fed1bcdfef0849cb5a844dfb..729b6a6d3b80a86034e6887fd3a0e87c3113a9fa 100644 (file)
@@ -117,10 +117,16 @@ mydaemon(int nochdir, int noclose)
 
        if (noclose == 0) {
                tempfd = open("/dev/null", O_RDWR);
-               dup2(tempfd, 0);
-               dup2(tempfd, 1);
-               dup2(tempfd, 2);
-               closeall(3);
+               if (tempfd >= 0) {
+                       dup2(tempfd, 0);
+                       dup2(tempfd, 1);
+                       dup2(tempfd, 2);
+                       close(tempfd);
+               } else {
+                       printerr(1, "mydaemon: can't open /dev/null: errno %d "
+                                   "(%s)\n", errno, strerror(errno));
+                       exit(1);
+               }
        }
 
        return;