Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/tmux/dist Avoid non-literal format strings by r...
details: https://anonhg.NetBSD.org/src/rev/06164fe92bb9
branches: trunk
changeset: 768728:06164fe92bb9
user: joerg <joerg%NetBSD.org@localhost>
date: Thu Aug 25 16:41:51 2011 +0000
description:
Avoid non-literal format strings by replacing asprintf with putc.
diffstat:
external/bsd/tmux/dist/log.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diffs (32 lines):
diff -r 1807f0568834 -r 06164fe92bb9 external/bsd/tmux/dist/log.c
--- a/external/bsd/tmux/dist/log.c Thu Aug 25 16:29:39 2011 +0000
+++ b/external/bsd/tmux/dist/log.c Thu Aug 25 16:41:51 2011 +0000
@@ -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 <nicm%users.sourceforge.net@localhost>
@@ -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;
}
}
Home |
Main Index |
Thread Index |
Old Index