More work on new server loop

This commit is contained in:
2014-08-08 21:46:02 +01:00
parent a52023a711
commit cc069c64db
8 changed files with 168 additions and 22 deletions

View File

@@ -21,7 +21,20 @@ void fatal(char* fmt, ...) {
vsnprintf(msg, LOG_LENGTH, fmt, va);
va_end(va);
LOG(LFATAL, msg);
if (errno != 0) {
char *errnostr = calloc(64, sizeof(char));
strerror_r(errno, errnostr, 64);
char *errstr = calloc(strlen(msg)+strlen(errnostr)+3, sizeof(char));
strcat(errstr, msg);
strcat(errstr, ": ");
strcat(errstr, errnostr);
LOG(LFATAL, errstr);
free(errnostr);
free(errstr);
} else {
LOG(LFATAL, msg);
}
log_register_clear();
exit(EXIT_FAILURE);
}