aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2023-04-03 14:31:18 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2023-04-03 14:41:01 +0200
commit7ababc3e3cd44cb51ad1b0183f7fe30df0fb3cbf (patch)
tree1781890e3272c69a674c7910161a01be7c3ecd5d
parent2860b2530e7391b52fc6f0d500981e78a4618551 (diff)
downloadbusybox-w32-7ababc3e3cd44cb51ad1b0183f7fe30df0fb3cbf.tar.gz
busybox-w32-7ababc3e3cd44cb51ad1b0183f7fe30df0fb3cbf.tar.bz2
busybox-w32-7ababc3e3cd44cb51ad1b0183f7fe30df0fb3cbf.zip
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 55c0acc16..f057b8963 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11265,8 +11265,8 @@ static smallint mail_var_path_changed;
11265/* 11265/*
11266 * Print appropriate message(s) if mail has arrived. 11266 * Print appropriate message(s) if mail has arrived.
11267 * If mail_var_path_changed is set, 11267 * If mail_var_path_changed is set,
11268 * then the value of MAIL has mail_var_path_changed, 11268 * then the value of MAIL has changed,
11269 * so we just update the values. 11269 * so we just update the hash value.
11270 */ 11270 */
11271static void 11271static void
11272chkmail(void) 11272chkmail(void)
@@ -11285,7 +11285,7 @@ chkmail(void)
11285 int len; 11285 int len;
11286 11286
11287 len = padvance_magic(&mpath, nullstr, 2); 11287 len = padvance_magic(&mpath, nullstr, 2);
11288 if (!len) 11288 if (len < 0)
11289 break; 11289 break;
11290 p = stackblock(); 11290 p = stackblock();
11291 if (*p == '\0') 11291 if (*p == '\0')
@@ -11306,8 +11306,8 @@ chkmail(void)
11306 if (!mail_var_path_changed && mailtime_hash != new_hash) { 11306 if (!mail_var_path_changed && mailtime_hash != new_hash) {
11307 if (mailtime_hash != 0) 11307 if (mailtime_hash != 0)
11308 out2str("you have mail\n"); 11308 out2str("you have mail\n");
11309 mailtime_hash = new_hash;
11310 } 11309 }
11310 mailtime_hash = new_hash;
11311 mail_var_path_changed = 0; 11311 mail_var_path_changed = 0;
11312 popstackmark(&smark); 11312 popstackmark(&smark);
11313} 11313}