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(); }