7c3f32e3b4
Add a syslog related fix from upstream. Reminded by Tiago Cunha, who sent me an update diff a few days ago.
50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
$OpenBSD: patch-log_c,v 1.1 2010/03/20 21:32:23 kili Exp $
|
|
|
|
From upstream darcs repository.
|
|
|
|
--- log.c.orig Tue Jan 8 13:56:45 2008
|
|
+++ log.c Wed Dec 2 18:33:40 2009
|
|
@@ -279,11 +279,14 @@ static void
|
|
accumulateSyslogV(int type, const char *f, va_list args)
|
|
{
|
|
int rc;
|
|
+ va_list args_copy;
|
|
|
|
again:
|
|
+ va_copy(args_copy, args);
|
|
rc = vsnprintf(syslogBuf + syslogBufLength,
|
|
syslogBufSize - syslogBufLength,
|
|
- f, args);
|
|
+ f, args_copy);
|
|
+ va_end(args_copy);
|
|
|
|
if(rc < 0 || rc >= syslogBufSize - syslogBufLength) {
|
|
rc = expandSyslog(rc);
|
|
@@ -372,7 +375,12 @@ really_do_log_v(int type, const char *f, va_list args)
|
|
{
|
|
if(type & LOGGING_MAX & logLevel) {
|
|
if(logF)
|
|
- vfprintf(logF, f, args);
|
|
+ {
|
|
+ va_list args_copy;
|
|
+ va_copy(args_copy, args);
|
|
+ vfprintf(logF, f, args_copy);
|
|
+ va_end(args_copy);
|
|
+ }
|
|
#ifdef HAVE_SYSLOG
|
|
if(logSyslog)
|
|
accumulateSyslogV(type, f, args);
|
|
@@ -399,8 +407,11 @@ really_do_log_error_v(int type, int e, const char *f,
|
|
es = "Unknown error";
|
|
|
|
if(logF) {
|
|
- vfprintf(logF, f, args);
|
|
+ va_list args_copy;
|
|
+ va_copy(args_copy, args);
|
|
+ vfprintf(logF, f, args_copy);
|
|
fprintf(logF, ": %s\n", es);
|
|
+ va_end(args_copy);
|
|
}
|
|
#ifdef HAVE_SYSLOG
|
|
if(logSyslog) {
|