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/ifstated/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/ifstated/parse.y')
-rw-r--r-- | usr.sbin/ifstated/parse.y | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.sbin/ifstated/parse.y b/usr.sbin/ifstated/parse.y index 24875a72f51..b5cd6d64498 100644 --- a/usr.sbin/ifstated/parse.y +++ b/usr.sbin/ifstated/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.30 2010/08/03 18:42:40 henning Exp $ */ +/* $OpenBSD: parse.y,v 1.31 2013/03/06 21:42:40 sthen Exp $ */ /* * Copyright (c) 2004 Ryan McBride <mcbride@openbsd.org> @@ -355,13 +355,15 @@ int yyerror(const char *fmt, ...) { 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); } |