I found a rather ugly solution to the daemon() call problem I mentioned
Instead of daemon(), I call fork(), create a copy of the command line
arguments, add an argument telling it not to fork again (otherwise we
end up recursively creating thousands and thousands of processes... ask
me how I know...) and call execve() to start a fresh new process. It's
ugly, it's hideous, but it at least lets me get back to work... In
theory, I could also call daemon() instead of fork(), but it seems that
would create more overhead than it's worth.