X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fsvcgssd%2Fsvcgssd.c;h=4e0806c30a425df6f915825d469e196e2e54c2b3;hp=3b5a981e3f2f3d780fec724716d95b14de6b17a8;hb=9d0fbcdce0289509de015bef41ecf5d676045dc4;hpb=651b5d3cf5428cbf1d2cd3ae572453af249bef1e diff --git a/utils/svcgssd/svcgssd.c b/utils/svcgssd/svcgssd.c index 3b5a981..4e0806c 100644 --- a/utils/svcgssd/svcgssd.c +++ b/utils/svcgssd/svcgssd.c @@ -54,6 +54,7 @@ #include #include #include +#include "nfslib.h" #include "svcgssd.h" #include "gss_util.h" #include "err_util.h" @@ -69,7 +70,7 @@ int pipefds[2] = { -1, -1}; static void mydaemon(int nochdir, int noclose) { - int pid, status, tempfd, fdmax, filedes; + int pid, status, tempfd; if (pipe(pipefds) < 0) { printerr(1, "mydaemon: pipe() failed: errno %d (%s)\n", @@ -113,13 +114,10 @@ mydaemon(int nochdir, int noclose) if (noclose == 0) { tempfd = open("/dev/null", O_RDWR); - close(0); dup2(tempfd, 0); - close(1); dup2(tempfd, 1); - close(2); dup2(tempfd, 2); - fdmax = sysconf (_SC_OPEN_MAX); - for (filedes = 3; filedes < fdmax; filedes++) - if (filedes != pipefds[1]) - close (filedes); + dup2(tempfd, 0); + dup2(tempfd, 1); + dup2(tempfd, 2); + closeall(3); } return;