From 8404b568345b64e14b1a98ae68a5d0b1f3b568ac Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 20 Oct 2011 14:24:52 +0530 Subject: core: build warning fixes the current way is very crude method to solve the warning issues with gcc 4.6.1+ versions. Actual fix is to go through each of such warnings and fix individually. added a TODO to remove the 'pragma' once we fix the root cause of warnings. till then this patch is work around to shift the build system. Change-Id: Icffc427b1d736e719e15f40e1dd89330ea395c40 BUG: 2550 Reviewed-on: http://review.gluster.com/625 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Vijay Bellur --- libglusterfs/src/daemon.c | 9 +++++++++ libglusterfs/src/globals.h | 7 +++++++ 2 files changed, 16 insertions(+) (limited to 'libglusterfs') 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; diff --git a/libglusterfs/src/globals.h b/libglusterfs/src/globals.h index 7003351ab55..5f4af861318 100644 --- a/libglusterfs/src/globals.h +++ b/libglusterfs/src/globals.h @@ -20,6 +20,13 @@ #ifndef _GLOBALS_H #define _GLOBALS_H +/* TODO: remove this 'pragma' by fixing the root cause of warnings */ +#if defined(__GNUC__) +#if __GNUC__ >= 4 +#pragma GCC diagnostic ignored "-Wunused-but-set-variable" +#endif +#endif + #define GF_DEFAULT_BASE_PORT 24007 /* This corresponds to the max 16 number of group IDs that are sent through an -- cgit