summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko2023-04-03 14:31:18 +0200
committerDenys Vlasenko2023-04-03 14:41:01 +0200
commit7ababc3e3cd44cb51ad1b0183f7fe30df0fb3cbf (patch)
tree1781890e3272c69a674c7910161a01be7c3ecd5d /shell
parent2860b2530e7391b52fc6f0d500981e78a4618551 (diff)
downloadbusybox-7ababc3e3cd44cb51ad1b0183f7fe30df0fb3cbf.zip
busybox-7ababc3e3cd44cb51ad1b0183f7fe30df0fb3cbf.tar.gz
ash: fix still-broken new mail detection
padvance() exit condition is return value < 0, not == 0. After MAIL changing twice, the logic erroneously concluded that "you have new mail". Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 55c0acc..f057b89 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11265,8 +11265,8 @@ static smallint mail_var_path_changed;
/*
* Print appropriate message(s) if mail has arrived.
* If mail_var_path_changed is set,
- * then the value of MAIL has mail_var_path_changed,
- * so we just update the values.
+ * then the value of MAIL has changed,
+ * so we just update the hash value.
*/
static void
chkmail(void)
@@ -11285,7 +11285,7 @@ chkmail(void)
int len;
len = padvance_magic(&mpath, nullstr, 2);
- if (!len)
+ if (len < 0)
break;
p = stackblock();
if (*p == '\0')
@@ -11306,8 +11306,8 @@ chkmail(void)
if (!mail_var_path_changed && mailtime_hash != new_hash) {
if (mailtime_hash != 0)
out2str("you have mail\n");
- mailtime_hash = new_hash;
}
+ mailtime_hash = new_hash;
mail_var_path_changed = 0;
popstackmark(&smark);
}