written by Mike Frysinger
https://sourceforge.net/tracker/?func=detail&aid=3132053&group_id=5616&atid=305616
Rather than using the fork function (which doesnt work on nommu
systems), simply use the daemon() function instead (which does
work). this should work the same before and after for all systems.
- if ((ret = fork()) > 0)
- syslog(LOG_INFO, "forking: %m");
- syslog(LOG_INFO, "detaching from tty: %m");
- if ((ret = fork()) > 0) {
- /* cleanup_files = 0; */
+ syslog(LOG_INFO, "daemon: %m");
/* Close all open inherited files! Except for ttyfd! */