]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/gssd/svcgssd.c
nfs-utils: Fix source code character encoding
[nfs-utils.git] / utils / gssd / svcgssd.c
index 69d2a6966946b287fed1bcdfef0849cb5a844dfb..e7375a49ce6b472106cc2ce64f26bb5eb3184537 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;
@@ -154,7 +160,7 @@ void
 sig_hup(int signal)
 {
        /* don't exit on SIGHUP */
-       printerr(1, "Received SIGHUP... Ignoring.\n");
+       printerr(1, "Received SIGHUP(%d)... Ignoring.\n", signal);
        return;
 }