DASH Shell discussions
 help / color / mirror / Atom feed
From: Brian Koropoff <bkoropoff@gmail.com>
To: dash@vger.kernel.org
Subject: [PATCH] Fix regression when unsetting variables.
Date: Tue, 15 Jun 2010 19:29:58 -0700	[thread overview]
Message-ID: <1276655398.16819.26.camel@gemini> (raw)

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



             reply	other threads:[~2010-06-16  2:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-16  2:29 Brian Koropoff [this message]
2010-07-06  9:42 ` [PATCH] Fix regression when unsetting variables Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1276655398.16819.26.camel@gemini \
    --to=bkoropoff@gmail.com \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox