diff options
author | reyk <reyk@openbsd.org> | 2017-01-09 14:49:21 +0000 |
---|---|---|
committer | reyk <reyk@openbsd.org> | 2017-01-09 14:49:21 +0000 |
commit | 871fc12c557cf094bf5ca1277faefd10ad038938 (patch) | |
tree | 9d48cbb6bdcc53c3019df0c2ffb62d382acc929b /usr.sbin/httpd | |
parent | pf_purge_thread() needs the NET_LOCK(). (diff) | |
download | wireguard-openbsd-871fc12c557cf094bf5ca1277faefd10ad038938.tar.xz wireguard-openbsd-871fc12c557cf094bf5ca1277faefd10ad038938.zip |
Stop accessing verbose and debug variables from log.c directly.
This replaces log_verbose() and "extern int verbose" with the two functions
log_setverbose() and log_getverbose().
Pointed out by benno@
OK krw@ eric@ gilles@ (OK gilles@ for the snmpd bits as well)
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r-- | usr.sbin/httpd/control.c | 4 | ||||
-rw-r--r-- | usr.sbin/httpd/httpd.c | 4 | ||||
-rw-r--r-- | usr.sbin/httpd/httpd.h | 5 | ||||
-rw-r--r-- | usr.sbin/httpd/log.c | 17 | ||||
-rw-r--r-- | usr.sbin/httpd/proc.c | 4 | ||||
-rw-r--r-- | usr.sbin/httpd/server.c | 5 |
6 files changed, 23 insertions, 16 deletions
diff --git a/usr.sbin/httpd/control.c b/usr.sbin/httpd/control.c index 3f3302ffd2a..7eea19a21d6 100644 --- a/usr.sbin/httpd/control.c +++ b/usr.sbin/httpd/control.c @@ -1,4 +1,4 @@ -/* $OpenBSD: control.c,v 1.12 2017/01/09 14:04:31 krw Exp $ */ +/* $OpenBSD: control.c,v 1.13 2017/01/09 14:49:22 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -290,7 +290,7 @@ control_dispatch_imsg(int fd, short event, void *arg) memcpy(imsg.data, &verbose, sizeof(verbose)); control_imsg_forward(env->sc_ps, &imsg); - log_verbose(verbose); + log_setverbose(verbose); break; default: log_debug("%s: error handling imsg %d", diff --git a/usr.sbin/httpd/httpd.c b/usr.sbin/httpd/httpd.c index 3f73a520382..47d6676444b 100644 --- a/usr.sbin/httpd/httpd.c +++ b/usr.sbin/httpd/httpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.c,v 1.62 2016/09/28 12:01:04 reyk Exp $ */ +/* $OpenBSD: httpd.c,v 1.63 2017/01/09 14:49:22 reyk Exp $ */ /* * Copyright (c) 2014 Reyk Floeter <reyk@openbsd.org> @@ -191,7 +191,7 @@ main(int argc, char *argv[]) ps->ps_csock.cs_name = NULL; log_init(debug, LOG_DAEMON); - log_verbose(verbose); + log_setverbose(verbose); if (env->sc_opts & HTTPD_OPT_NOACTION) ps->ps_noaction = 1; diff --git a/usr.sbin/httpd/httpd.h b/usr.sbin/httpd/httpd.h index d0892b6f3f6..75b1b893743 100644 --- a/usr.sbin/httpd/httpd.h +++ b/usr.sbin/httpd/httpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.h,v 1.124 2016/11/17 14:52:48 jsing Exp $ */ +/* $OpenBSD: httpd.h,v 1.125 2017/01/09 14:49:22 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org> @@ -685,7 +685,8 @@ extern struct httpd *httpd_env; /* 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 *, ...) diff --git a/usr.sbin/httpd/log.c b/usr.sbin/httpd/log.c index 04cb7b212d6..f46f58f65a5 100644 --- a/usr.sbin/httpd/log.c +++ b/usr.sbin/httpd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.12 2017/01/08 20:31:03 reyk Exp $ */ +/* $OpenBSD: log.c,v 1.13 2017/01/09 14:49:22 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -24,13 +24,14 @@ #include <errno.h> #include <time.h> -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/usr.sbin/httpd/proc.c b/usr.sbin/httpd/proc.c index 7f88461a852..a1014eb30ab 100644 --- a/usr.sbin/httpd/proc.c +++ b/usr.sbin/httpd/proc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.c,v 1.34 2016/10/12 10:57:30 reyk Exp $ */ +/* $OpenBSD: proc.c,v 1.35 2017/01/09 14:49:22 reyk Exp $ */ /* * Copyright (c) 2010 - 2016 Reyk Floeter <reyk@openbsd.org> @@ -662,7 +662,7 @@ proc_dispatch(int fd, short event, void *arg) case IMSG_CTL_VERBOSE: IMSG_SIZE_CHECK(&imsg, &verbose); memcpy(&verbose, imsg.data, sizeof(verbose)); - log_verbose(verbose); + log_setverbose(verbose); break; case IMSG_CTL_PROCFD: IMSG_SIZE_CHECK(&imsg, &pf); diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c index 6fdb1464138..9afc7c179fa 100644 --- a/usr.sbin/httpd/server.c +++ b/usr.sbin/httpd/server.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server.c,v 1.100 2016/11/17 14:58:37 jsing Exp $ */ +/* $OpenBSD: server.c,v 1.101 2017/01/09 14:49:22 reyk Exp $ */ /* * Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org> @@ -1153,14 +1153,13 @@ server_log(struct client *clt, const char *msg) struct server_config *srv_conf = clt->clt_srv_conf; char *ptr = NULL, *vmsg = NULL; int debug_cmd = -1; - extern int verbose; switch (srv_conf->logformat) { case LOG_FORMAT_CONNECTION: debug_cmd = IMSG_LOG_ACCESS; break; default: - if (verbose > 1) + if (log_getverbose() > 1) debug_cmd = IMSG_LOG_ERROR; if (EVBUFFER_LENGTH(clt->clt_log)) { while ((ptr = |