if MAIL is unset, we can short circuit the check a little bit.

Index: mail.c
===================================================================
RCS file: /cvs/src/bin/ksh/mail.c,v
retrieving revision 1.24
diff -u -p -r1.24 mail.c
--- mail.c      25 Jun 2018 15:22:30 -0000      1.24
+++ mail.c      10 Dec 2018 02:56:55 -0000
@@ -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;
@@ -55,13 +64,6 @@ mcheck(void)
        timespecsub(&now, &mlastchkd, &elapsed);
        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 &&

Reply via email to