diff options
author | Chet Ramey <chet.ramey@case.edu> | 2011-11-21 20:49:12 -0500 |
---|---|---|
committer | Chet Ramey <chet.ramey@case.edu> | 2011-11-21 20:49:12 -0500 |
commit | 89a92869e56aba4e4cab2d639c00a86f0545c862 (patch) | |
tree | e1cd4da50318af8ab1f3141d39d4b0b8e1e7c500 /builtins/read.def | |
parent | 17345e5ad288f7543b77b23a25aa380eacc279f2 (diff) | |
download | android_external_bash-89a92869e56aba4e4cab2d639c00a86f0545c862.tar.gz android_external_bash-89a92869e56aba4e4cab2d639c00a86f0545c862.tar.bz2 android_external_bash-89a92869e56aba4e4cab2d639c00a86f0545c862.zip |
Bash-4.0 patchlevel 38
Diffstat (limited to 'builtins/read.def')
-rw-r--r-- | builtins/read.def | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/builtins/read.def b/builtins/read.def index fb4366f..8fc5647 100644 --- a/builtins/read.def +++ b/builtins/read.def @@ -369,14 +369,14 @@ read_builtin (list) code = setjmp (alrmbuf); if (code) { -#if 0 + /* Tricky. The top of the unwind-protect stack is the free of + input_string. We want to run all the rest and use input_string, + so we have to remove it from the stack. */ + remove_unwind_protect (); run_unwind_frame ("read_builtin"); - return (EXECUTION_FAILURE); -#else input_string[i] = '\0'; /* make sure it's terminated */ - retval = 128+SIGALRM;; + retval = 128+SIGALRM; goto assign_vars; -#endif } old_alrm = set_signal_handler (SIGALRM, sigalrm); add_unwind_protect (reset_alarm, (char *)NULL); @@ -601,14 +601,15 @@ add_char: if (unbuffered_read == 0) zsyncfd (fd); - interrupt_immediately--; - terminate_immediately--; discard_unwind_frame ("read_builtin"); retval = eof ? EXECUTION_FAILURE : EXECUTION_SUCCESS; assign_vars: + interrupt_immediately--; + terminate_immediately--; + #if defined (ARRAY_VARS) /* If -a was given, take the string read, break it into a list of words, an assign them to `arrayname' in turn. */ @@ -763,7 +764,10 @@ assign_vars: if (*input_string == 0) tofree = input_string = t; else - input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, saw_escape); + { + input_string = strip_trailing_ifs_whitespace (t1, ifs_chars, saw_escape); + tofree = t; + } } #endif |