Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-04-03 15:31:18 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2023-04-25 17:47:22 +0300
commit90f5f2a190bca489fac513a150ffab79c6f585b2 (patch)
treeec7400f7a16e95650ce263e238a77dc3f337417b
parent07bc5de67b2724a6ed9bb980f3439504b67e20ec (diff)
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>
-rw-r--r--shell/ash.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c
index c15bce7ae..9344e4de1 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11264,8 +11264,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)
@@ -11284,7 +11284,7 @@ chkmail(void)
int len;
len = padvance_magic(&mpath, nullstr, 2);
- if (!len)
+ if (len < 0)
break;
p = stackblock();
if (*p == '\0')
@@ -11305,8 +11305,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);
}