X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fgssd%2Fsvcgssd.c;h=e7375a49ce6b472106cc2ce64f26bb5eb3184537;hb=76209cdbe989ee4cdfbf489f2695ac779457e763;hp=69d2a6966946b287fed1bcdfef0849cb5a844dfb;hpb=f91afa8eaee1d7ba390918d00d4f7d3f338d18d3;p=nfs-utils.git diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c index 69d2a69..e7375a4 100644 --- a/utils/gssd/svcgssd.c +++ b/utils/gssd/svcgssd.c @@ -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; }