void serr(int eval, const char *fmt, ...) { if (fmt != NULL) { va_list ap; char buf[2048]; int bufused; va_start(ap, fmt); bufused = vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); if (errno != 0) snprintf(&buf[bufused], sizeof(buf) - bufused, ": %s (errno = %d)", strerror(errno), errno); slog(LOG_ERR, "%s", buf); } #if SOCKS_CLIENT exit(eval); #else sockdexit(eval); #endif /* SOCKS_CLIENT */ }
void serrx(const char *fmt, ...) { if (fmt != NULL) { va_list ap, apcopy; va_start(ap, fmt); va_start(apcopy, fmt); vslog(LOG_ERR, fmt, ap, apcopy); /* LINTED expression has null effect */ va_end(apcopy); va_end(ap); } #if SOCKS_CLIENT exit(EXIT_FAILURE); #else sockdexit(EXIT_FAILURE); #endif /* SOCKS_CLIENT */ }