summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-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