summaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2010-09-17 14:38:17 +0200
committerSylvain Munaut <tnt@246tNt.com>2010-09-17 14:38:17 +0200
commitaf5ee34c353ea2868a4b04b227bc1b511e1ac42b (patch)
treedd0cb703f458c39f6c8fe5d467f879ec2c42f34e /src/process.c
parent77b6f6c53672f3d3c3335f17572bf4425122bd62 (diff)
Make sure we don't user std{err,in,out} if they don't exist.
This is required for target build in libosmocore Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/process.c b/src/process.c
index ab4b37e3..180efa51 100644
--- a/src/process.c
+++ b/src/process.c
@@ -63,9 +63,12 @@ int osmo_daemonize(void)
return rc;
/* Redirect stdio to /dev/null */
+/* since C89/C99 says stderr is a macro, we can safely do this! */
+#ifdef stderr
freopen("/dev/null", "r", stdin);
freopen("/dev/null", "w", stdout);
freopen("/dev/null", "w", stderr);
+#endif
return 0;
}