From 09aaf50cda52fb852d0fb2b63ca4c6511136e930 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 26 May 2006 22:43:51 +0000 Subject: 22464: bad recursion if error in prompt substitution --- Src/Zle/zle_main.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'Src/Zle') 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--; } /**/ -- cgit 1.4.1