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 playing games with format strin...



details:   https://anonhg.NetBSD.org/src/rev/578fe730f337
branches:  trunk
changeset: 330889:578fe730f337
user:      joerg <joerg%NetBSD.org@localhost>
date:      Thu Jul 24 22:59:01 2014 +0000

description:
Avoid playing games with format strings, just use a second printf.

diffstat:

 external/bsd/tmux/dist/log.c |  7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diffs (23 lines):

diff -r d60fff1d125d -r 578fe730f337 external/bsd/tmux/dist/log.c
--- a/external/bsd/tmux/dist/log.c      Thu Jul 24 22:54:38 2014 +0000
+++ b/external/bsd/tmux/dist/log.c      Thu Jul 24 22:59:01 2014 +0000
@@ -73,17 +73,14 @@
 void
 log_vwrite(const char *msg, va_list ap)
 {
-       char    *fmt;
-
        if (log_file == NULL)
                return;
 
-       if (asprintf(&fmt, "%s\n", msg) == -1)
+       if (vfprintf(log_file, msg, ap) == -1)
                exit(1);
-       if (vfprintf(log_file, fmt, ap) == -1)
+       if (fprintf(log_file, "\n") == -1)
                exit(1);
        fflush(log_file);
-       free(fmt);
 }
 
 /* Log a warning with error string. */



Home | Main Index | Thread Index | Old Index