diff options
author | sobomax <sobomax@FreeBSD.org> | 2007-04-24 05:56:39 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2007-04-24 05:56:39 +0000 |
commit | fc7fa0685e2ab483c6fd545b4cf99c1f2d8696df (patch) | |
tree | 8526e51f7208c0a018005226f5e89d727a786a30 /net | |
parent | 64bb8b352e4c350f261072578796ccfb823f42b5 (diff) | |
download | FreeBSD-ports-fc7fa0685e2ab483c6fd545b4cf99c1f2d8696df.zip FreeBSD-ports-fc7fa0685e2ab483c6fd545b4cf99c1f2d8696df.tar.gz |
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.
Diffstat (limited to 'net')
-rw-r--r-- | net/vncreflector/Makefile | 2 | ||||
-rw-r--r-- | net/vncreflector/files/patch-logging.c | 46 |
2 files changed, 47 insertions, 1 deletions
diff --git a/net/vncreflector/Makefile b/net/vncreflector/Makefile index ae0660d..b83e935 100644 --- a/net/vncreflector/Makefile +++ b/net/vncreflector/Makefile @@ -7,7 +7,7 @@ PORTNAME= vncreflector PORTVERSION= 1.2.4 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= net MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR=vnc-reflector diff --git a/net/vncreflector/files/patch-logging.c b/net/vncreflector/files/patch-logging.c new file mode 100644 index 0000000..060e4d5 --- /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); + } + |