diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2013-03-06 21:42:41 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2013-03-06 21:42:41 +0000 |
commit | 834788bd80e85adeb26df5bdbc0c36fc24acc620 (patch) | |
tree | 86ac9ae7bb432e076a63797b30b5101c77fd7cf1 /usr.sbin/ldpd/parse.y | |
parent | 5dd3d437333a69206e71ab5766e778b9ac597cad (diff) |
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/ldpd/parse.y')
-rw-r--r-- | usr.sbin/ldpd/parse.y | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.sbin/ldpd/parse.y b/usr.sbin/ldpd/parse.y index ed4bc2a7558..5b86208ffad 100644 --- a/usr.sbin/ldpd/parse.y +++ b/usr.sbin/ldpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.7 2010/09/01 13:54:54 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.8 2013/03/06 21:42:40 sthen Exp $ */ /* * Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org> @@ -36,6 +36,7 @@ #include <stdarg.h> #include <stdio.h> #include <string.h> +#include <syslog.h> #include "ldp.h" #include "ldpd.h" @@ -323,14 +324,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); } |