summaryrefslogtreecommitdiff
path: root/net/vncreflector/files/patch-logging.c
diff options
context:
space:
mode:
authorMaxim Sobolev <sobomax@FreeBSD.org>2007-04-24 05:56:39 +0000
committerMaxim Sobolev <sobomax@FreeBSD.org>2007-04-24 05:56:39 +0000
commitfe39c2ed7846c3778b13a864017617b8f473d38e (patch)
tree428cbc9de9d9a42afa1b9674a65d43184310e91e /net/vncreflector/files/patch-logging.c
parent- maintainer resign. (diff)
Our v*printf() family of functions don't return va_list to its original
state upon return, therefore if we want to call such functions several times on different streams we need to wrap each call to va_start/va_end otherwise it either prints garbage on second and subsequent invocation or simply crashes the program.
Notes
Notes: svn path=/head/; revision=190783
Diffstat (limited to 'net/vncreflector/files/patch-logging.c')
-rw-r--r--net/vncreflector/files/patch-logging.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/net/vncreflector/files/patch-logging.c b/net/vncreflector/files/patch-logging.c
new file mode 100644
index 000000000000..060e4d5d8a70
--- /dev/null
+++ b/net/vncreflector/files/patch-logging.c
@@ -0,0 +1,46 @@
+
+$FreeBSD$
+
+--- logging.c
++++ logging.c
+@@ -10,7 +10,7 @@
+ * This software was authored by Constantin Kaplinsky <const@ce.cctpu.edu.ru>
+ * and sponsored by HorizonLive.com, Inc.
+ *
+- * $Id: logging.c,v 1.1 2007/04/24 05:32:17 root Exp $
++ * $Id: logging.c,v 1.5 2003/04/21 17:20:35 const Exp $
+ * Logging implementation
+ */
+
+@@ -138,8 +138,6 @@
+ char time_buf[32];
+ char level_char = ' ';
+
+- va_start(arg_list, format);
+-
+ if ( (log_fp != NULL && level <= log_file_level) ||
+ level <= log_stderr_level ) {
+ now = time(NULL);
+@@ -150,18 +148,21 @@
+
+ if (level <= log_file_level) {
+ fprintf(log_fp, "%s %c ", time_buf, (int)level_char);
++ va_start(arg_list, format);
+ vfprintf(log_fp, format, arg_list);
++ va_end(arg_list);
+ fprintf(log_fp, "\n");
+ fflush(log_fp);
+ }
+ if (level <= log_stderr_level) {
+ fprintf(stderr, "%s %c ", time_buf, (int)level_char);
++ va_start(arg_list, format);
+ vfprintf(stderr, format, arg_list);
++ va_end(arg_list);
+ fprintf(stderr, "\n");
+ fflush(stderr);
+ }
+ }
+
+- va_end(arg_list);
+ }
+