summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2017-01-09 14:49:23 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2017-01-09 14:49:23 +0000
commit65cbefc932ed629628895ae2493bd64c22ef3d1e (patch)
treeea73a27d1af80c78c53341594644b4c83a054ac5 /usr.sbin/smtpd
parent086789f41ebba4437094c99922f574254973b86f (diff)
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/smtpd')
-rw-r--r--usr.sbin/smtpd/log.c17
-rw-r--r--usr.sbin/smtpd/log.h5
-rw-r--r--usr.sbin/smtpd/scheduler.c4
-rw-r--r--usr.sbin/smtpd/util.c4
4 files changed, 19 insertions, 11 deletions
diff --git a/usr.sbin/smtpd/log.c b/usr.sbin/smtpd/log.c
index b4094db8030..d2761937749 100644
--- a/usr.sbin/smtpd/log.c
+++ b/usr.sbin/smtpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.18 2017/01/09 09:53:23 reyk Exp $ */
+/* $OpenBSD: log.c,v 1.19 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/smtpd/log.h b/usr.sbin/smtpd/log.h
index 4b2bbe840bb..8120653cc9e 100644
--- a/usr.sbin/smtpd/log.h
+++ b/usr.sbin/smtpd/log.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.h,v 1.6 2017/01/09 09:53:23 reyk Exp $ */
+/* $OpenBSD: log.h,v 1.7 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2010 Gilles Chehade <gilles@poolp.org>
@@ -21,7 +21,8 @@
/* 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/smtpd/scheduler.c b/usr.sbin/smtpd/scheduler.c
index f8516f2ddd6..f6c11de853e 100644
--- a/usr.sbin/smtpd/scheduler.c
+++ b/usr.sbin/smtpd/scheduler.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scheduler.c,v 1.55 2016/09/08 12:06:43 eric Exp $ */
+/* $OpenBSD: scheduler.c,v 1.56 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -306,7 +306,7 @@ scheduler_imsg(struct mproc *p, struct imsg *imsg)
m_msg(&m, imsg);
m_get_int(&m, &v);
m_end(&m);
- log_verbose(v);
+ log_setverbose(v);
return;
case IMSG_CTL_PROFILE:
diff --git a/usr.sbin/smtpd/util.c b/usr.sbin/smtpd/util.c
index c4d4824fdc2..4a509ed4520 100644
--- a/usr.sbin/smtpd/util.c
+++ b/usr.sbin/smtpd/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.131 2017/01/09 09:53:23 reyk Exp $ */
+/* $OpenBSD: util.c,v 1.132 2017/01/09 14:49:22 reyk Exp $ */
/*
* Copyright (c) 2000,2001 Markus Friedl. All rights reserved.
@@ -812,5 +812,5 @@ log_trace_verbose(int v)
tracing = v;
/* Set debug logging in log.c */
- log_verbose(v & TRACE_DEBUG ? 2 : foreground_log);
+ log_setverbose(v & TRACE_DEBUG ? 2 : foreground_log);
}