about summary refs log tree commit diff
path: root/Src/Zle
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-05-26 22:43:51 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-05-26 22:43:51 +0000
commit09aaf50cda52fb852d0fb2b63ca4c6511136e930 (patch)
treecfd95d45a79c0fa6946f1c5e9fbfd565496998e1 /Src/Zle
parent7c87409d6214b384741fed2543fcd9a590c6b20d (diff)
downloadzsh-09aaf50cda52fb852d0fb2b63ca4c6511136e930.tar.gz
zsh-09aaf50cda52fb852d0fb2b63ca4c6511136e930.tar.xz
zsh-09aaf50cda52fb852d0fb2b63ca4c6511136e930.zip
22464: bad recursion if error in prompt substitution
Diffstat (limited to 'Src/Zle')
-rw-r--r--Src/Zle/zle_main.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 904bf148e..5751d5329 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1509,10 +1509,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--;
 }
 
 /**/