summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src/daemon.c')
-rw-r--r--libglusterfs/src/daemon.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libglusterfs/src/daemon.c b/libglusterfs/src/daemon.c
index 38dfd3f386b..3d4383f8ca7 100644
--- a/libglusterfs/src/daemon.c
+++ b/libglusterfs/src/daemon.c
@@ -49,10 +49,19 @@ os_daemon (int nochdir, int noclose)
if (!nochdir)
ret = chdir("/");
+ ret = -1;
if (!noclose) {
ptr = freopen ("/dev/null", "r", stdin);
+ if (!ptr)
+ goto out;
+
ptr = freopen ("/dev/null", "w", stdout);
+ if (!ptr)
+ goto out;
+
ptr = freopen ("/dev/null", "w", stderr);
+ if (!ptr)
+ goto out;
}
ret = 0;