summaryrefslogtreecommitdiffstats
path: root/utils/idmapd
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2006-06-23 17:10:56 +1000
committerNeil Brown <neilb@suse.de>2006-06-23 17:10:56 +1000
commit0523fd513c6baa8dbf45d1a7afea2044262aeb3d (patch)
tree124eade50a8f75cbb2bb8688aff958367a0f4b90 /utils/idmapd
parent2e075a16da4963f54cd556403ca9e15a68de27fd (diff)
downloadnfs-utils-0523fd513c6baa8dbf45d1a7afea2044262aeb3d.tar.gz
nfs-utils-0523fd513c6baa8dbf45d1a7afea2044262aeb3d.tar.xz
nfs-utils-0523fd513c6baa8dbf45d1a7afea2044262aeb3d.zip
Further coverity related cleanups.
Greg Banks suggested some variations, particularly improved use of xmalloc/xstrdup functions. Thanks.
Diffstat (limited to 'utils/idmapd')
-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;