summaryrefslogtreecommitdiffstats
path: root/usr.sbin/switchd/util.c
diff options
context:
space:
mode:
authorreyk <reyk@openbsd.org>2017-01-09 14:49:21 +0000
committerreyk <reyk@openbsd.org>2017-01-09 14:49:21 +0000
commit871fc12c557cf094bf5ca1277faefd10ad038938 (patch)
tree9d48cbb6bdcc53c3019df0c2ffb62d382acc929b /usr.sbin/switchd/util.c
parentpf_purge_thread() needs the NET_LOCK(). (diff)
downloadwireguard-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/switchd/util.c')
-rw-r--r--usr.sbin/switchd/util.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/usr.sbin/switchd/util.c b/usr.sbin/switchd/util.c
index d8ab3762aef..d53e674ecf4 100644
--- a/usr.sbin/switchd/util.c
+++ b/usr.sbin/switchd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.5 2016/11/15 09:05:14 reyk Exp $ */
+/* $OpenBSD: util.c,v 1.6 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2013-2016 Reyk Floeter <reyk@openbsd.org>
@@ -37,9 +37,6 @@
#include "switchd.h"
-extern int debug;
-extern int verbose;
-
void
socket_set_blockmode(int fd, enum blockmodes bm)
{
@@ -313,7 +310,7 @@ print_debug(const char *emsg, ...)
{
va_list ap;
- if (debug && verbose > 2) {
+ if (log_getverbose() > 2) {
va_start(ap, emsg);
vfprintf(stderr, emsg, ap);
va_end(ap);
@@ -325,7 +322,7 @@ print_verbose(const char *emsg, ...)
{
va_list ap;
- if (verbose) {
+ if (log_getverbose()) {
va_start(ap, emsg);
vfprintf(stderr, emsg, ap);
va_end(ap);
@@ -336,9 +333,8 @@ void
print_hex(uint8_t *buf, off_t offset, size_t length)
{
unsigned int i;
- extern int verbose;
- if (verbose < 3 || !length)
+ if (log_getverbose() < 3 || !length)
return;
for (i = 0; i < length; i++) {