summaryrefslogtreecommitdiff
path: root/usr.sbin/dvmrpd
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2014-11-03 16:56:00 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2014-11-03 16:56:00 +0000
commit054c4539411911be51bd4b436759f03d8023baea (patch)
treea9a7015f81045d8febf00e4cd45d6b00ecb10a21 /usr.sbin/dvmrpd
parente89c4773678d25885dd8624ae40ab7c1c4c49288 (diff)
Convert the logic in yyerror(). Instead of creating a temporary
format string, create a temporary message. OK benno@ doug@ claudio@
Diffstat (limited to 'usr.sbin/dvmrpd')
-rw-r--r--usr.sbin/dvmrpd/log.c4
-rw-r--r--usr.sbin/dvmrpd/log.h3
-rw-r--r--usr.sbin/dvmrpd/parse.y12
3 files changed, 9 insertions, 10 deletions
diff --git a/usr.sbin/dvmrpd/log.c b/usr.sbin/dvmrpd/log.c
index 782a8f85d55..daabb5f6053 100644
--- a/usr.sbin/dvmrpd/log.c
+++ b/usr.sbin/dvmrpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.3 2011/08/20 19:02:28 sthen Exp $ */
+/* $OpenBSD: log.c,v 1.4 2014/11/03 16:55:59 bluhm Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -37,8 +37,6 @@ static const char * const procnames[] = {
int debug;
int verbose;
-void logit(int, const char *, ...);
-
void
log_init(int n_debug)
{
diff --git a/usr.sbin/dvmrpd/log.h b/usr.sbin/dvmrpd/log.h
index 33e4dbf60d8..100dcc3bae6 100644
--- a/usr.sbin/dvmrpd/log.h
+++ b/usr.sbin/dvmrpd/log.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.h,v 1.2 2009/11/02 20:31:50 claudio Exp $ */
+/* $OpenBSD: log.h,v 1.3 2014/11/03 16:55:59 bluhm Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -23,6 +23,7 @@
void log_init(int);
void log_verbose(int);
+void logit(int, const char *, ...);
void vlog(int, const char *, va_list);
void log_warn(const char *, ...);
void log_warnx(const char *, ...);
diff --git a/usr.sbin/dvmrpd/parse.y b/usr.sbin/dvmrpd/parse.y
index be48ffaed8f..2d987ac8ada 100644
--- a/usr.sbin/dvmrpd/parse.y
+++ b/usr.sbin/dvmrpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.26 2014/01/22 00:21:16 henning Exp $ */
+/* $OpenBSD: parse.y,v 1.27 2014/11/03 16:55:59 bluhm Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -359,15 +359,15 @@ int
yyerror(const char *fmt, ...)
{
va_list ap;
- char *nfmt;
+ char *msg;
file->errors++;
va_start(ap, fmt);
- if (asprintf(&nfmt, "%s:%d: %s", file->name, yylval.lineno, fmt) == -1)
- fatalx("yyerror asprintf");
- vlog(LOG_CRIT, nfmt, ap);
+ if (vasprintf(&msg, fmt, ap) == -1)
+ fatalx("yyerror vasprintf");
va_end(ap);
- free(nfmt);
+ logit(LOG_CRIT, "%s:%d: %s", file->name, yylval.lineno, msg);
+ free(msg);
return (0);
}