X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fidmapd%2Fidmapd.c;h=5fc7811a8465b3c5be2ce35ef85c628fc639d092;hp=1231db4045dab5023dfc3504c3111ce44aef6eab;hb=0523fd513c6baa8dbf45d1a7afea2044262aeb3d;hpb=2e075a16da4963f54cd556403ca9e15a68de27fd diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c index 1231db4..5fc7811 100644 --- a/utils/idmapd/idmapd.c +++ b/utils/idmapd/idmapd.c @@ -1003,12 +1003,15 @@ mydaemon(int nochdir, int noclose) if (noclose == 0) { tempfd = open("/dev/null", O_RDWR); + if (tempfd < 0) + tempfd = open("/", O_RDONLY); if (tempfd >= 0) { dup2(tempfd, 0); dup2(tempfd, 1); dup2(tempfd, 2); - } - closeall(3); + closeall(3); + } else + closeall(0); } return;