diff options
authorThorsten Alteholz <osmocom@alteholz.de>2017-03-13 00:58:53 +0100
committerHarald Welte <laforge@gnumonks.org>2017-04-08 07:45:13 +0000
commit18a62b04887d8c6f6d338404330391a66c337b69 (patch)
parent15596e2a7f101c5db7454d21aabf16dd3878de15 (diff)
compiler warnings: take care of compiler warning "unused-result"
Though it makes no sense to handle the return code of freopen() here, the compiler complains about it. The #pragma statements take care of that. Change-Id: Ia2caadbed2a24f84d1d55a47236b398b74224e82
1 files changed, 7 insertions, 0 deletions
diff --git a/src/application.c b/src/application.c
index 4112e75c..6a18d0e0 100644
--- a/src/application.c
+++ b/src/application.c
@@ -156,9 +156,16 @@ int osmo_daemonize(void)
/* Redirect stdio to /dev/null */
/* since C89/C99 says stderr is a macro, we can safely do this! */
#ifdef stderr
+ * it does not make sense to check the return code here, so we just
+ * ignore the compiler warning from gcc
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wunused-result"
freopen("/dev/null", "r", stdin);
freopen("/dev/null", "w", stdout);
freopen("/dev/null", "w", stderr);
+#pragma GCC diagnostic pop
return 0;