[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] ash: an unset dynamic variable should not be dynamic
From:       Ron Yorston <rmy () pobox ! com>
Date:       2019-04-08 15:36:24
Message-ID: 5cab6a78.vI7o71GIfRAbNsYY%rmy () pobox ! com
[Download RAW message or body]

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 <rmy@pobox.com>
---
 shell/ash.c | 4 ++++
 1 file changed, 4 insertions(+)

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)
-- 
2.20.1

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic