diff options
author | sthen <sthen@openbsd.org> | 2013-03-06 21:42:40 +0000 |
---|---|---|
committer | sthen <sthen@openbsd.org> | 2013-03-06 21:42:40 +0000 |
commit | 4a1d3eaab3099cdab0ba2f7230cb3a914c520749 (patch) | |
tree | 1d43116713d7524f8d13dcc4791edeb33d6717ff /usr.sbin/ripd/parse.y | |
parent | sync yyerror() with version in bgpd so that it logs to syslog when daemonized. (diff) | |
download | wireguard-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/ripd/parse.y')
-rw-r--r-- | usr.sbin/ripd/parse.y | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/ripd/parse.y b/usr.sbin/ripd/parse.y index 8cb73eec7dc..9334e8d6943 100644 --- a/usr.sbin/ripd/parse.y +++ b/usr.sbin/ripd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.28 2010/08/03 18:42:41 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.29 2013/03/06 21:42:40 sthen Exp $ */ /* * Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it> @@ -37,6 +37,7 @@ #include <stdarg.h> #include <stdio.h> #include <string.h> +#include <syslog.h> #include "ripd.h" #include "rip.h" @@ -378,14 +379,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); } |