1 written by Mike Frysinger
3 https://sourceforge.net/tracker/?func=detail&aid=3132053&group_id=5616&atid=305616
5 Rather than using the fork function (which doesnt work on nommu
6 systems), simply use the daemon() function instead (which does
7 work). this should work the same before and after for all systems.
13 void fork_now(int ttyfd)
18 - if ((ret = fork()) > 0)
22 - syslog(LOG_INFO, "forking: %m");
24 - syslog(LOG_INFO, "detaching from tty: %m");
26 - if ((ret = fork()) > 0) {
27 - /* cleanup_files = 0; */
31 + syslog(LOG_INFO, "daemon: %m");
33 /* Close all open inherited files! Except for ttyfd! */
34 for (i = 0; i < 64; i++)