summaryrefslogtreecommitdiffstats
path: root/utils/idmapd/idmapd.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/idmapd/idmapd.c')
-rw-r--r--utils/idmapd/idmapd.c7
1 files changed, 5 insertions, 2 deletions
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;