summaryrefslogtreecommitdiff
path: root/usr.sbin/ospfd/parse.y
diff options
context:
space:
mode:
authorStuart Henderson <sthen@cvs.openbsd.org>2013-03-06 21:36:58 +0000
committerStuart Henderson <sthen@cvs.openbsd.org>2013-03-06 21:36:58 +0000
commit5dd3d437333a69206e71ab5766e778b9ac597cad (patch)
tree6bbe103eeda24c4f0dcbe8cd9ae3ccadd1aec46c /usr.sbin/ospfd/parse.y
parent9dbd4b32ee87dfada9de3f779581dd609316528f (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.y13
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);
}