From: Ron Yorston Date: Mon, 15 Apr 2019 09:49:35 +0000 (+0100) Subject: ash: an unset dynamic variable should not be dynamic X-Git-Tag: 1_31_0~96 X-Git-Url: https://git.librecmc.org/?p=oweals%2Fbusybox.git;a=commitdiff_plain;h=d96c69d87619e62a88cad1eeda795ac36b417c1c ash: an unset dynamic variable should not be dynamic Commit b28d4c346 (ash: [VAR] Move unsetvar functionality into setvareq) dropped the code that caused dynamic variables to lose their special properties when unset. Add it back again. function old new delta setvareq 346 360 +14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 14/0) Total: 14 bytes Signed-off-by: Ron Yorston Signed-off-by: Denys Vlasenko --- diff --git a/shell/ash.c b/shell/ash.c index 34d5d6d68..255d57e62 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -2364,6 +2364,10 @@ setvareq(char *s, int flags) } flags |= vp->flags & ~(VTEXTFIXED|VSTACK|VNOSAVE|VUNSET); +#if ENABLE_ASH_RANDOM_SUPPORT + if (flags & VUNSET) + flags &= ~VDYNAMIC; +#endif } else { /* variable s is not found */ if (flags & VNOSET)