summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2003-08-17 18:35:56 +0000
committerume <ume@FreeBSD.org>2003-08-17 18:35:56 +0000
commit6cbfc845049551247d14475b66930ab1b91ffe57 (patch)
tree83ba0411dd5ca0ce6f560eb4fd18b61f0bbab366
parentf7ff921e4dd9b589e760f5c443afb3b5bd8540cc (diff)
downloadFreeBSD-src-6cbfc845049551247d14475b66930ab1b91ffe57.zip
FreeBSD-src-6cbfc845049551247d14475b66930ab1b91ffe57.tar.gz
- don't print strerror() if errno == 0 on fatal().
- va_start/end audit. - can't use vfprintf() twice. need va_start/end pair every time. Obtained from: KAME MFC after: 1 week
-rw-r--r--usr.sbin/route6d/route6d.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/usr.sbin/route6d/route6d.c b/usr.sbin/route6d/route6d.c
index 6702b64..e2030b7 100644
--- a/usr.sbin/route6d/route6d.c
+++ b/usr.sbin/route6d/route6d.c
@@ -3335,10 +3335,13 @@ fatal(fmt, va_alist)
va_start(ap);
#endif
vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
perror(buf);
- syslog(LOG_ERR, "%s: %s", buf, strerror(errno));
+ if (errno)
+ syslog(LOG_ERR, "%s: %s", buf, strerror(errno));
+ else
+ syslog(LOG_ERR, "%s", buf);
rtdexit();
- va_end(ap);
}
void
@@ -3353,22 +3356,28 @@ tracet(level, fmt, va_alist)
{
va_list ap;
+ if (level <= dflag) {
#ifdef __STDC__
- va_start(ap, fmt);
+ va_start(ap, fmt);
#else
- va_start(ap);
+ va_start(ap);
#endif
- if (level <= dflag) {
fprintf(stderr, "%s: ", hms());
vfprintf(stderr, fmt, ap);
+ va_end(ap);
}
if (dflag) {
+#ifdef __STDC__
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
if (level > 0)
vsyslog(LOG_DEBUG, fmt, ap);
else
vsyslog(LOG_WARNING, fmt, ap);
+ va_end(ap);
}
- va_end(ap);
}
void
@@ -3383,20 +3392,27 @@ trace(level, fmt, va_alist)
{
va_list ap;
+ if (level <= dflag) {
#ifdef __STDC__
- va_start(ap, fmt);
+ va_start(ap, fmt);
#else
- va_start(ap);
+ va_start(ap);
#endif
- if (level <= dflag)
vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ }
if (dflag) {
+#ifdef __STDC__
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
if (level > 0)
vsyslog(LOG_DEBUG, fmt, ap);
else
vsyslog(LOG_WARNING, fmt, ap);
+ va_end(ap);
}
- va_end(ap);
}
unsigned int
OpenPOWER on IntegriCloud