diff options
author | Jari Aalto <jari.aalto@cante.net> | 2009-02-19 22:21:29 +0000 |
---|---|---|
committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:47:02 +0000 |
commit | 17345e5ad288f7543b77b23a25aa380eacc279f2 (patch) | |
tree | 8ac954624147c08ebe1f72f38e0fa5e0416ce87d /builtins/read.def | |
parent | 3185942a5234e26ab13fa02f9c51d340cec514f8 (diff) | |
download | android_external_bash-17345e5ad288f7543b77b23a25aa380eacc279f2.tar.gz android_external_bash-17345e5ad288f7543b77b23a25aa380eacc279f2.tar.bz2 android_external_bash-17345e5ad288f7543b77b23a25aa380eacc279f2.zip |
Imported from ../bash-4.0.tar.gz.
Diffstat (limited to 'builtins/read.def')
-rw-r--r-- | builtins/read.def | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/builtins/read.def b/builtins/read.def index c93681e..fb4366f 100644 --- a/builtins/read.def +++ b/builtins/read.def @@ -290,9 +290,8 @@ read_builtin (list) } list = loptend; - /* `read -t 0 var' returns failure immediately. XXX - should it test - whether input is available with select/FIONREAD, and fail if those - are unavailable? */ + /* `read -t 0 var' tests whether input is available with select/FIONREAD, + and fails if those are unavailable */ if (have_timeout && tmsec == 0 && tmusec == 0) #if 0 return (EXECUTION_FAILURE); @@ -417,10 +416,9 @@ read_builtin (list) termsave.attrs = &ttattrs; ttset = ttattrs; - if (silent) - ttfd_cbreak (fd, &ttset); /* ttcbreak () */ - else - ttfd_onechar (fd, &ttset); /* ttonechar () */ + i = silent ? ttfd_cbreak (fd, &ttset) : ttfd_onechar (fd, &ttset); + if (i < 0) + sh_ttyerror (1); add_unwind_protect ((Function *)ttyrestore, (char *)&termsave); } } @@ -432,7 +430,9 @@ read_builtin (list) termsave.attrs = &ttattrs; ttset = ttattrs; - ttfd_noecho (fd, &ttset); /* ttnoecho (); */ + i = ttfd_noecho (fd, &ttset); /* ttnoecho (); */ + if (i < 0) + sh_ttyerror (1); add_unwind_protect ((Function *)ttyrestore, (char *)&termsave); } |