daemonize is a UNIX daemon launcher. It starts a process in the background and releases any open file handles before launching the daemon. daemonize guarantees that the final parent proccess of the daemon launched is the init process and that the daemon is no longer associated with the launching application (unless it's init directly).
daemonize also makes a best-effort attempt to EXIT_FAILURE in the event that the daemon fails to launch.