This is a signal safe version of snprintf/vsnprintf. The code is originally from the OpenBSD libc.