about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWayne Davison <wayned@users.sourceforge.net>2002-02-22 20:40:29 +0000
committerWayne Davison <wayned@users.sourceforge.net>2002-02-22 20:40:29 +0000
commit663c6e794abd0a5b7972930bdfb26a178b5826fd (patch)
tree282272ed4a565d34be5419ffa65532a54eacacd5
parent73a4362713b8fb624ec70a5d86d4e5d87fba2b7b (diff)
downloadzsh-663c6e794abd0a5b7972930bdfb26a178b5826fd.tar.gz
zsh-663c6e794abd0a5b7972930bdfb26a178b5826fd.tar.xz
zsh-663c6e794abd0a5b7972930bdfb26a178b5826fd.zip
In putoldhistentryontop(), ensure that we can't return with "next" set to
the value we just put on top.
-rw-r--r--Src/hist.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Src/hist.c b/Src/hist.c
index 5c8ac8d95..492c876ec 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -924,14 +924,15 @@ putoldhistentryontop(short keep_going)
 	if (!keep_going)
 	    max_unique_ct = getiparam("SAVEHIST");
 	do {
-	    if (max_unique_ct-- <= 0) {
+	    if (max_unique_ct-- <= 0 || he == hist_ring) {
 		max_unique_ct = 0;
 		he = hist_ring->down;
+		next = hist_ring;
 		break;
 	    }
 	    he = next;
 	    next = he->down;
-	} while (he != hist_ring->down && !(he->flags & HIST_DUP));
+	} while (!(he->flags & HIST_DUP));
     }
     if (he != hist_ring->down) {
 	he->up->down = he->down;