aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c32
1 files changed, 20 insertions, 12 deletions
diff --git a/shell/ash.c b/shell/ash.c
index f3a2c6952..924e17f32 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -13043,6 +13043,9 @@ expandstr(const char *ps, int syntax_type)
13043 union node n; 13043 union node n;
13044 int saveprompt; 13044 int saveprompt;
13045 struct parsefile *file_stop = g_parsefile; 13045 struct parsefile *file_stop = g_parsefile;
13046 volatile int saveint;
13047 struct jmploc *volatile savehandler = exception_handler;
13048 struct jmploc jmploc;
13046 13049
13047 /* XXX Fix (char *) cast. */ 13050 /* XXX Fix (char *) cast. */
13048 setinputstring((char *)ps); 13051 setinputstring((char *)ps);
@@ -13054,18 +13057,13 @@ expandstr(const char *ps, int syntax_type)
13054 * Try a prompt with syntactically wrong command: 13057 * Try a prompt with syntactically wrong command:
13055 * PS1='$(date "+%H:%M:%S) > ' 13058 * PS1='$(date "+%H:%M:%S) > '
13056 */ 13059 */
13057 { 13060 SAVE_INT(saveint);
13058 volatile int saveint; 13061 if (setjmp(jmploc.loc) == 0) {
13059 struct jmploc *volatile savehandler = exception_handler; 13062 exception_handler = &jmploc;
13060 struct jmploc jmploc; 13063 readtoken1(pgetc(), syntax_type, FAKEEOFMARK, 0);
13061 SAVE_INT(saveint);
13062 if (setjmp(jmploc.loc) == 0) {
13063 exception_handler = &jmploc;
13064 readtoken1(pgetc(), syntax_type, FAKEEOFMARK, 0);
13065 }
13066 exception_handler = savehandler;
13067 RESTORE_INT(saveint);
13068 } 13064 }
13065 exception_handler = savehandler;
13066 RESTORE_INT(saveint);
13069 13067
13070 doprompt = saveprompt; 13068 doprompt = saveprompt;
13071 13069
@@ -13077,7 +13075,17 @@ expandstr(const char *ps, int syntax_type)
13077 n.narg.text = wordtext; 13075 n.narg.text = wordtext;
13078 n.narg.backquote = backquotelist; 13076 n.narg.backquote = backquotelist;
13079 13077
13080 expandarg(&n, NULL, EXP_QUOTED); 13078 /* expandarg() might fail too:
13079 * PS1='$((123+))'
13080 */
13081 SAVE_INT(saveint);
13082 if (setjmp(jmploc.loc) == 0) {
13083 exception_handler = &jmploc;
13084 expandarg(&n, NULL, EXP_QUOTED);
13085 }
13086 exception_handler = savehandler;
13087 RESTORE_INT(saveint);
13088
13081 return stackblock(); 13089 return stackblock();
13082} 13090}
13083 13091