summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2019-01-07 20:50:43 +0000
committertedu <tedu@openbsd.org>2019-01-07 20:50:43 +0000
commitb582ba36add6a1c58510baa801ec125523cdac6a (patch)
treeaa3c58111bd2655e6e6f73c61d95b4c1514c8129
parentlog dns failures, even if temporary. ok benno (diff)
downloadwireguard-openbsd-b582ba36add6a1c58510baa801ec125523cdac6a.tar.xz
wireguard-openbsd-b582ba36add6a1c58510baa801ec125523cdac6a.zip
short circuit mail check if MAIL is unset. ok anton
-rw-r--r--bin/ksh/mail.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/bin/ksh/mail.c b/bin/ksh/mail.c
index f4b31e0c3bf..570722d57bc 100644
--- a/bin/ksh/mail.c
+++ b/bin/ksh/mail.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mail.c,v 1.24 2018/06/25 15:22:30 cheloha Exp $ */
+/* $OpenBSD: mail.c,v 1.25 2019/01/07 20:50:43 tedu Exp $ */
/*
* Mailbox checking code by Robert J. Gibson, adapted for PD ksh by
@@ -47,6 +47,15 @@ mcheck(void)
struct stat stbuf;
static int first = 1;
+ if (mplist)
+ mbp = mplist;
+ else if ((vp = global("MAIL")) && (vp->flag & ISSET))
+ mbp = &mbox;
+ else
+ mbp = NULL;
+ if (mbp == NULL)
+ return;
+
clock_gettime(CLOCK_MONOTONIC, &now);
if (first) {
mlastchkd = now;
@@ -56,13 +65,6 @@ mcheck(void)
if (elapsed.tv_sec >= mailcheck_interval) {
mlastchkd = now;
- if (mplist)
- mbp = mplist;
- else if ((vp = global("MAIL")) && (vp->flag & ISSET))
- mbp = &mbox;
- else
- mbp = NULL;
-
while (mbp) {
if (mbp->mb_path && stat(mbp->mb_path, &stbuf) == 0 &&
S_ISREG(stbuf.st_mode)) {