summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-10-20 14:24:52 +0530
committerVijay Bellur <vijay@gluster.com>2011-10-23 22:46:56 -0700
commit8404b568345b64e14b1a98ae68a5d0b1f3b568ac (patch)
treefae0ff72675ddd1ed3064713f5c4d7562034a660
parent79b07b3d09b549b2955e94a4281445453501a968 (diff)
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 <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--libglusterfs/src/daemon.c9
-rw-r--r--libglusterfs/src/globals.h7
2 files changed, 16 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;
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