about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_main.c13
2 files changed, 14 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index a3f394aab..24108151d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-26  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* 22464: Src/Zle/zle_main.c: an error in prompt substitution could
+	cause bad recursion karma.
+
 2006-01-10  Peter Stephenson  <pws@csr.com>
 
 	* 22151: Src/text.c: a here-string got too many quotes when
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index c6e374bc7..69e88c8b4 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1342,10 +1342,15 @@ recursiveedit(UNUSED(char **args))
 void
 reexpandprompt(void)
 {
-    free(lpromptbuf);
-    lpromptbuf = promptexpand(raw_lp ? *raw_lp : NULL, 1, NULL, NULL);
-    free(rpromptbuf);
-    rpromptbuf = promptexpand(raw_rp ? *raw_rp : NULL, 1, NULL, NULL);
+    static reexpanding;
+
+    if (!reexpanding++) {
+	free(lpromptbuf);
+	lpromptbuf = promptexpand(raw_lp ? *raw_lp : NULL, 1, NULL, NULL);
+	free(rpromptbuf);
+	rpromptbuf = promptexpand(raw_rp ? *raw_rp : NULL, 1, NULL, NULL);
+    }
+    reexpanding--;
 }
 
 /**/