X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fidmapd%2Fidmapd.c;h=1231db4045dab5023dfc3504c3111ce44aef6eab;hp=158feaf66c11627beb931ab253d7c56cb9722c6b;hb=2e075a16da4963f54cd556403ca9e15a68de27fd;hpb=ff42180930a444cea7f19e55e2cd2bfe6d3f108b diff --git a/utils/idmapd/idmapd.c b/utils/idmapd/idmapd.c index 158feaf..1231db4 100644 --- a/utils/idmapd/idmapd.c +++ b/utils/idmapd/idmapd.c @@ -1003,9 +1003,11 @@ mydaemon(int nochdir, int noclose) if (noclose == 0) { tempfd = open("/dev/null", O_RDWR); - dup2(tempfd, 0); - dup2(tempfd, 1); - dup2(tempfd, 2); + if (tempfd >= 0) { + dup2(tempfd, 0); + dup2(tempfd, 1); + dup2(tempfd, 2); + } closeall(3); }