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, 8 insertions, 1 deletions
diff --git a/libglusterfs/src/daemon.c b/libglusterfs/src/daemon.c
index 51b14810cc4..778196164b8 100644
--- a/libglusterfs/src/daemon.c
+++ b/libglusterfs/src/daemon.c
@@ -29,7 +29,6 @@ os_daemon_return (int nochdir, int noclose)
int ret = -1;
FILE *ptr = NULL;
-
ret = fork();
if (ret)
return ret;
@@ -46,8 +45,16 @@ os_daemon_return (int nochdir, int noclose)
if (!noclose) {
ptr = freopen (DEVNULLPATH, "r", stdin);
+ if (!ptr)
+ goto out;
+
ptr = freopen (DEVNULLPATH, "w", stdout);
+ if (!ptr)
+ goto out;
+
ptr = freopen (DEVNULLPATH, "w", stderr);
+ if (!ptr)
+ goto out;
}
ret = 0;