fix a windows bug; from nick mathewson

svn:r146
This commit is contained in:
Niels Provos 2005-04-09 03:32:11 +00:00
parent d47798be5a
commit 6ba5e0d03e

13
log.c
View File

@ -87,6 +87,17 @@ event_vsnprintf(char *str, size_t size, const char *format, va_list args)
return r;
}
static int
event_snprintf(char *str, size_t size, const char *format, ...)
{
va_list ap;
int r;
va_start(ap, format);
r = event_vsnprintf(str, size, format, ap);
va_end(ap);
return r;
}
void
event_err(int eval, const char *fmt, ...)
{
@ -163,7 +174,7 @@ _warn_helper(int severity, int log_errno, const char *fmt, va_list ap)
if (log_errno >= 0) {
len = strlen(buf);
if (len < sizeof(buf) - 3) {
snprintf(buf + len, sizeof(buf) - len, ": %s",
event_snprintf(buf + len, sizeof(buf) - len, ": %s",
strerror(log_errno));
}
}