Module Name: src
Committed By: joerg
Date: Thu Aug 25 16:41:51 UTC 2011
Modified Files:
src/external/bsd/tmux/dist: log.c
Log Message:
Avoid non-literal format strings by replacing asprintf with putc.
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/bsd/tmux/dist/log.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/tmux/dist/log.c
diff -u src/external/bsd/tmux/dist/log.c:1.1.1.2 src/external/bsd/tmux/dist/log.c:1.2
--- src/external/bsd/tmux/dist/log.c:1.1.1.2 Wed Aug 17 18:40:04 2011
+++ src/external/bsd/tmux/dist/log.c Thu Aug 25 16:41:51 2011
@@ -1,4 +1,4 @@
-/* $Id: log.c,v 1.1.1.2 2011/08/17 18:40:04 jmmv Exp $ */
+/* $Id: log.c,v 1.2 2011/08/25 16:41:51 joerg Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <[email protected]>
@@ -85,7 +85,6 @@
void
log_vwrite(int pri, const char *msg, va_list ap)
{
- char *fmt;
FILE *f = log_file;
switch (log_type) {
@@ -96,12 +95,11 @@
f = stderr;
/* FALLTHROUGH */
case LOG_TYPE_FILE:
- if (asprintf(&fmt, "%s\n", msg) == -1)
+ if (vfprintf(f, msg, ap) == -1)
exit(1);
- if (vfprintf(f, fmt, ap) == -1)
+ if (putc('\n', f) == -1)
exit(1);
fflush(f);
- free(fmt);
break;
}
}