diff --git a/src/usr.sbin/ntpd/log.c b/src/usr.sbin/ntpd/log.c index c297efe7..0db0245c 100644 --- a/src/usr.sbin/ntpd/log.c +++ b/src/usr.sbin/ntpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.8 2007/08/22 21:04:30 ckuethe Exp $ */ +/* $OpenBSD: log.c,v 1.9 2014/11/03 20:15:30 bluhm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -29,8 +29,6 @@ int debug; extern int debugsyslog; -void logit(int, const char *, ...); - void log_init(int n_debug) { diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h index f1c540b9..be15ea0e 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.110 2014/10/25 03:23:49 lteo Exp $ */ +/* $OpenBSD: ntpd.h,v 1.111 2014/11/03 20:15:30 bluhm Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -271,6 +271,7 @@ enum ctl_actions { /* prototypes */ /* log.c */ void log_init(int); +void logit(int, const char *, ...); void vlog(int, const char *, va_list); void log_warn(const char *, ...); void log_warnx(const char *, ...); diff --git a/src/usr.sbin/ntpd/parse.y b/src/usr.sbin/ntpd/parse.y index 90d4bed2..67683a1c 100644 --- a/src/usr.sbin/ntpd/parse.y +++ b/src/usr.sbin/ntpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.52 2013/11/25 12:58:42 benno Exp $ */ +/* $OpenBSD: parse.y,v 1.53 2014/11/03 20:15:31 bluhm Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -339,15 +339,15 @@ int yyerror(const char *fmt, ...) { va_list ap; - char *nfmt; + char *msg; file->errors++; va_start(ap, fmt); - if (asprintf(&nfmt, "%s:%d: %s", file->name, yylval.lineno, fmt) == -1) - fatalx("yyerror asprintf"); - vlog(LOG_CRIT, nfmt, ap); + if (vasprintf(&msg, fmt, ap) == -1) + fatalx("yyerror vasprintf"); va_end(ap); - free(nfmt); + logit(LOG_CRIT, "%s:%d: %s", file->name, yylval.lineno, msg); + free(msg); return (0); }