diff --git a/src/usr.sbin/ntpd/log.c b/src/usr.sbin/ntpd/log.c index 6e56032c..270df657 100644 --- a/src/usr.sbin/ntpd/log.c +++ b/src/usr.sbin/ntpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.15 2017/01/08 20:31:03 reyk Exp $ */ +/* $OpenBSD: log.c,v 1.16 2017/01/09 14:49:22 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -24,13 +24,14 @@ #include #include -int debug; -int verbose; +static int debug; +static int verbose; const char *log_procname; void log_init(int, int); void log_procinit(const char *); -void log_verbose(int); +void log_setverbose(int); +int log_getverbose(void); void log_warn(const char *, ...) __attribute__((__format__ (printf, 1, 2))); void log_warnx(const char *, ...) @@ -71,11 +72,17 @@ log_procinit(const char *procname) } void -log_verbose(int v) +log_setverbose(int v) { verbose = v; } +int +log_getverbose(void) +{ + return (verbose); +} + void logit(int pri, const char *fmt, ...) { diff --git a/src/usr.sbin/ntpd/ntpd.c b/src/usr.sbin/ntpd/ntpd.c index 59f12ab4..0ec3ede0 100644 --- a/src/usr.sbin/ntpd/ntpd.c +++ b/src/usr.sbin/ntpd/ntpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.c,v 1.112 2016/12/01 16:24:48 mestre Exp $ */ +/* $OpenBSD: ntpd.c,v 1.113 2017/01/09 14:49:22 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -209,7 +209,7 @@ main(int argc, char *argv[]) reset_adjtime(); if (!lconf.settime) { log_init(lconf.debug, LOG_DAEMON); - log_verbose(lconf.verbose); + log_setverbose(lconf.verbose); if (!lconf.debug) if (daemon(1, 0)) fatal("daemon"); @@ -284,7 +284,7 @@ main(int argc, char *argv[]) lconf.settime = 0; timeout = INFTIM; log_init(lconf.debug, LOG_DAEMON); - log_verbose(lconf.verbose); + log_setverbose(lconf.verbose); log_warnx("no reply received in time, skipping initial " "time setting"); if (!lconf.debug) @@ -384,7 +384,7 @@ dispatch_imsg(struct ntpd_conf *lconf, int argc, char **argv) if (!lconf->settime) break; log_init(lconf->debug, LOG_DAEMON); - log_verbose(lconf->verbose); + log_setverbose(lconf->verbose); memcpy(&d, imsg.data, sizeof(d)); ntpd_settime(d); /* daemonize now */ diff --git a/src/usr.sbin/ntpd/ntpd.h b/src/usr.sbin/ntpd/ntpd.h index 965bb72a..fb9cd871 100644 --- a/src/usr.sbin/ntpd/ntpd.h +++ b/src/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.133 2016/09/26 17:17:01 rzalamena Exp $ */ +/* $OpenBSD: ntpd.h,v 1.134 2017/01/09 14:49:22 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -408,7 +408,8 @@ void build_show_sensor(struct ctl_show_sensor *, /* log.c */ void log_init(int, int); void log_procinit(const char *); -void log_verbose(int); +void log_setverbose(int); +int log_getverbose(void); void log_warn(const char *, ...) __attribute__((__format__ (printf, 1, 2))); void log_warnx(const char *, ...)