summary refs log tree commit diff
path: root/bin/dash
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-10-02 20:38:40 +0000
committerJune McEnroe <june@causal.agency>2021-10-02 20:38:40 +0000
commit45fa1d1d1ef8c1df0a56b0bf27f6845b626165d5 (patch)
tree1d1855382d329e733eb2422a8984cea1f92a6b82 /bin/dash
parentFix chkmail loop break condition (diff)
downloadsrc-45fa1d1d1ef8c1df0a56b0bf27f6845b626165d5.tar.gz
src-45fa1d1d1ef8c1df0a56b0bf27f6845b626165d5.zip
Just zero mailsize on changemail
So that on start (and any time MAIL/MAILPATH change), any non-empty
mailboxes will be reported.
Diffstat (limited to '')
-rw-r--r--bin/dash/src/mail.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/bin/dash/src/mail.c b/bin/dash/src/mail.c
index ec5bd103..a6571538 100644
--- a/bin/dash/src/mail.c
+++ b/bin/dash/src/mail.c
@@ -38,6 +38,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <stdlib.h>
+#include <string.h>
 
 #include "shell.h"
 #include "nodes.h"
@@ -54,14 +55,11 @@
 
 /* sizes of mailboxes */
 static off_t mailsize[MAXMBOXES];
-/* Set if MAIL or MAILPATH is changed. */
-static int changed;
 
 
 
 /*
- * Print appropriate message(s) if mail has arrived.  If changed is set,
- * then the value of MAIL has changed, so we just update the values.
+ * Print appropriate message(s) if mail has arrived.
  */
 
 void
@@ -95,7 +93,7 @@ chkmail(void)
 			*msp = 0;
 			continue;
 		}
-		if (!changed && statb.st_size > *msp) {
+		if (statb.st_size > *msp) {
 			outfmt(
 				&errout, snlfmt,
 				pathopt ? pathopt : "you have mail"
@@ -103,7 +101,6 @@ chkmail(void)
 		}
 		*msp = statb.st_size;
 	}
-	changed = 0;
 	popstackmark(&smark);
 }
 
@@ -111,5 +108,5 @@ chkmail(void)
 void
 changemail(const char *val)
 {
-	changed++;
+	memset(mailsize, 0, sizeof(mailsize));
 }