diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2006-05-26 22:45:45 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2006-05-26 22:45:45 +0000 |
commit | c0810e3c0226efaf362419ea3a8d1f6d7f74ca20 (patch) | |
tree | 78dda92affa0498e082f9ce1ac9c236644ee8c34 /Src/Zle | |
parent | fe1ddacd822e1a279dee902dd3f9a364c68f33de (diff) | |
download | zsh-c0810e3c0226efaf362419ea3a8d1f6d7f74ca20.tar.gz zsh-c0810e3c0226efaf362419ea3a8d1f6d7f74ca20.tar.xz zsh-c0810e3c0226efaf362419ea3a8d1f6d7f74ca20.zip |
22464: bad recursion if error in prompt substitution
Diffstat (limited to 'Src/Zle')
-rw-r--r-- | Src/Zle/zle_main.c | 13 |
1 files changed, 9 insertions, 4 deletions
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--; } /**/ |