summaryrefslogtreecommitdiffstats
path: root/usr.sbin/dvmrpd
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2013-03-06 21:42:40 +0000
committersthen <sthen@openbsd.org>2013-03-06 21:42:40 +0000
commit4a1d3eaab3099cdab0ba2f7230cb3a914c520749 (patch)
tree1d43116713d7524f8d13dcc4791edeb33d6717ff /usr.sbin/dvmrpd
parentsync yyerror() with version in bgpd so that it logs to syslog when daemonized. (diff)
downloadwireguard-openbsd-4a1d3eaab3099cdab0ba2f7230cb3a914c520749.tar.xz
wireguard-openbsd-4a1d3eaab3099cdab0ba2f7230cb3a914c520749.zip
as done in ospf{,6}d/relayd, sync yyerror in various other daemons with
that from bgpd, so that it logs to syslog when daemonized.
Diffstat (limited to 'usr.sbin/dvmrpd')
-rw-r--r--usr.sbin/dvmrpd/parse.y12
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/dvmrpd/parse.y b/usr.sbin/dvmrpd/parse.y
index 5832c8df696..3cd88e91752 100644
--- a/usr.sbin/dvmrpd/parse.y
+++ b/usr.sbin/dvmrpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.22 2010/12/31 21:22:42 guenther Exp $ */
+/* $OpenBSD: parse.y,v 1.23 2013/03/06 21:42:40 sthen Exp $ */
/*
* Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -358,14 +358,16 @@ struct keywords {
int
yyerror(const char *fmt, ...)
{
- va_list ap;
+ va_list ap;
+ char *nfmt;
file->errors++;
va_start(ap, fmt);
- fprintf(stderr, "%s:%d: ", file->name, yylval.lineno);
- vfprintf(stderr, fmt, ap);
- fprintf(stderr, "\n");
+ if (asprintf(&nfmt, "%s:%d: %s", file->name, yylval.lineno, fmt) == -1)
+ fatalx("yyerror asprintf");
+ vlog(LOG_CRIT, nfmt, ap);
va_end(ap);
+ free(nfmt);
return (0);
}