DASH Shell discussions
 help / color / mirror / Atom feed
* [PATCH] Fix regression when unsetting variables.
@ 2010-06-16  2:29 Brian Koropoff
  2010-07-06  9:42 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Koropoff @ 2010-06-16  2:29 UTC (permalink / raw)
  To: dash

When removing a variable from its hash chain, assign to the 'next' pointer
of the previous link rather than the hash bucket.
---
 src/var.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/var.c b/src/var.c
index f456fbd..c0e5706 100644
--- a/src/var.c
+++ b/src/var.c
@@ -238,11 +238,11 @@ intmax_t setvarint(const char *name, intmax_t val, int flags)
 void
 setvareq(char *s, int flags)
 {
-	struct var *vp, **vpp;
+	struct var *vp, **vpp, **fvpp;
 
 	vpp = hashvar(s);
 	flags |= (VEXPORT & (((unsigned) (1 - aflag)) - 1));
-	vp = *findvar(vpp, s);
+	vp = *(fvpp = findvar(vpp, s));
 	if (vp) {
 		if (vp->flags & VREADONLY) {
 			const char *n;
@@ -265,7 +265,7 @@ setvareq(char *s, int flags)
 
 		if (((flags & (VEXPORT|VREADONLY|VSTRFIXED|VUNSET)) |
 		     (vp->flags & VSTRFIXED)) == VUNSET) {
-			*vpp = vp->next;
+			*fvpp = vp->next;
 			ckfree(vp);
 out_free:
 			if ((flags & (VTEXTFIXED|VSTACK|VNOSAVE)) == VNOSAVE)
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-07-06  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-16  2:29 [PATCH] Fix regression when unsetting variables Brian Koropoff
2010-07-06  9:42 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox