From 84ebee8c20ce667a5ec5fddc0aa47f8b5bef39f8 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 18 Oct 2011 10:30:42 +0530 Subject: build: warning suppression (round n) with this patch, there are no more warnings with gcc (GCC) 4.6.1 20110908 Change-Id: Ice0d52d304b9846395f8a4a191c98eb53125f792 BUG: 2550 Reviewed-on: http://review.gluster.com/607 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/daemon.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libglusterfs/src/daemon.c') diff --git a/libglusterfs/src/daemon.c b/libglusterfs/src/daemon.c index 51b14810c..778196164 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; -- cgit