Patch from Alan Curry in
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=298582.
Basically, openlog was getting fd 0 for the log in some circumstances,
and safe_fork() was doing closelog after getting the desired stdin
dup'd to fd 0. This fixes it by doing the closelog a little earlier.