diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2013-03-06 21:36:58 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2013-03-06 21:36:58 +0000 |
commit | 5dd3d437333a69206e71ab5766e778b9ac597cad (patch) | |
tree | 6bbe103eeda24c4f0dcbe8cd9ae3ccadd1aec46c /usr.sbin/ospfd/parse.y | |
parent | 9dbd4b32ee87dfada9de3f779581dd609316528f (diff) |
sync yyerror() with version in bgpd so that it logs to syslog when daemonized.
ok florian@
Diffstat (limited to 'usr.sbin/ospfd/parse.y')
-rw-r--r-- | usr.sbin/ospfd/parse.y | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/ospfd/parse.y b/usr.sbin/ospfd/parse.y index f329acc620d..004d1f05637 100644 --- a/usr.sbin/ospfd/parse.y +++ b/usr.sbin/ospfd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.73 2010/12/13 13:43:37 bluhm Exp $ */ +/* $OpenBSD: parse.y,v 1.74 2013/03/06 21:36:57 sthen Exp $ */ /* * Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org> @@ -36,6 +36,7 @@ #include <stdarg.h> #include <stdio.h> #include <string.h> +#include <syslog.h> #include "ospf.h" #include "ospfd.h" @@ -692,14 +693,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); } |