Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/rtsold Don't modify format string, use asprintf to ...



details:   https://anonhg.NetBSD.org/src/rev/72ff0cd5f024
branches:  trunk
changeset: 328082:72ff0cd5f024
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Mar 25 21:07:59 2014 +0000

description:
Don't modify format string, use asprintf to format the original msg and
syslog the result.

diffstat:

 usr.sbin/rtsold/rtsold.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (23 lines):

diff -r 749c1fc21d37 -r 72ff0cd5f024 usr.sbin/rtsold/rtsold.c
--- a/usr.sbin/rtsold/rtsold.c  Tue Mar 25 19:43:48 2014 +0000
+++ b/usr.sbin/rtsold/rtsold.c  Tue Mar 25 21:07:59 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsold.c,v 1.41 2014/03/25 17:17:44 joerg Exp $        */
+/*     $NetBSD: rtsold.c,v 1.42 2014/03/25 21:07:59 joerg Exp $        */
 /*     $KAME: rtsold.c,v 1.77 2004/01/03 01:35:13 itojun Exp $ */
 
 /*
@@ -661,9 +661,10 @@
                if (priority <= log_upto)
                        vwarnx(msg, ap);
        } else {
-               char buf[BUFSIZ];
-               snprintf(buf, sizeof(buf), "<%s> %s", func, msg);
-               vsyslog(priority, buf, ap);
+               char *buf;
+               evasprintf(&buf, msg, ap);
+               syslog(priority, "<%s> %s", func, buf);
+               free(buf);
        }
        va_end(ap);
 }



Home | Main Index | Thread Index | Old Index