From 24cb202678f3ce89bfd9625a1b03fdd692522ff6 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 4 Mar 2020 08:53:47 -0500 Subject: [PATCH] fix compilation under musl libc closes #943 Change-Id: Ie192325e83ee129380ce1af2d235c0942a9b5afa --- lib/auxlib.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/auxlib.c b/lib/auxlib.c index 030656451..54b90a4af 100644 --- a/lib/auxlib.c +++ b/lib/auxlib.c @@ -33,9 +33,15 @@ void daemonize(void) { if (fork()) _exit(0); write_log = (write_log_t *) syslog; +#ifdef __GLIBC__ stdin = freopen("/dev/null", "r", stdin); stdout = freopen("/dev/null", "w", stdout); stderr = freopen("/dev/null", "w", stderr); +#else + freopen("/dev/null", "r", stdin); + freopen("/dev/null", "w", stdout); + freopen("/dev/null", "w", stderr); +#endif setpgrp(); }