fix deadlock in sighandler
more fix for sighandler
add safe_snprintf
change all loga to log_safe in signal handler.
Merge pull request #231 from idning/sighandler

fix deadlock in sighandler