Check if channel is writable to prevent crash.
Fix for daemon() deprecated in OS X

In OS X daemon() is deprecated in favor of launchd(), to allow compilation added conditional fake daemon function.

As in: http://www.opensource.apple.com/source/mDNSResponder/mDNSResponder-258.13/mDNSPosix/PosixDaemon.c
Successfully working on OS X.

Successfully working on Apple OS X.
Requires the trick for deprecation of daemon().