diff options
author | Christopher Faylor <me@cgf.cx> | 2002-12-20 01:38:55 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-12-20 01:38:55 +0000 |
commit | 388aa9941b2432a02513283858cac6c74bb25a0d (patch) | |
tree | 7f10f872a8b5500b5dd8750c31acbb24b24106c2 /winsup | |
parent | e9f731caf79a961f6c4fc56e30cfda65343786a4 (diff) | |
download | newlib-388aa9941b2432a02513283858cac6c74bb25a0d.zip newlib-388aa9941b2432a02513283858cac6c74bb25a0d.tar.gz newlib-388aa9941b2432a02513283858cac6c74bb25a0d.tar.bz2 |
* fhandler.h (line_edit_status): Add a new element.
* fhandler_termios.cc (fhandler_termios::line_edit): After accept_input, handle
both potential error condition and pipe full conditions.
* fhandler_tty.cc (fhandler_pty_master::accept_input): Return -1 on error.
(fhandler_pty_master::write): Handle pipe full condition.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 10 | ||||
-rw-r--r-- | winsup/cygwin/fhandler.h | 3 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_termios.cc | 5 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_tty.cc | 13 |
4 files changed, 25 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index f0015a1..5e2643c 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,13 @@ +2002-12-19 Steve Osborn <bub@io.com> + + * fhandler.h (line_edit_status): Add a new element. + * fhandler_termios.cc (fhandler_termios::line_edit): After + accept_input, handle both potential error condition and pipe full + conditions. + * fhandler_tty.cc (fhandler_pty_master::accept_input): Return -1 on + error. + (fhandler_pty_master::write): Handle pipe full condition. + 2002-12-16 Steve Osborn <bub@io.com> Christopher Faylor <cgf@redhat.com> diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 0e7b027..bea1bf2 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -123,7 +123,8 @@ enum line_edit_status line_edit_signalled = -1, line_edit_ok = 0, line_edit_input_done = 1, - line_edit_error = 2 + line_edit_error = 2, + line_edit_pipe_full = 3 }; enum bg_check_types diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc index e6a1132..9cd2561 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -326,9 +326,10 @@ fhandler_termios::line_edit (const char *rptr, int nread, int always_accept) put_readahead (c); if (!iscanon || always_accept || input_done) { - if (!accept_input ()) + int status = accept_input (); + if (status != 1) { - ret = line_edit_error; + ret = status ? line_edit_error : line_edit_pipe_full; eat_readahead (1); break; } diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index f5f0c79..0a5ba76 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -169,6 +169,7 @@ fhandler_pty_master::accept_input () { debug_printf ("error writing to pipe %E"); get_ttyp ()->read_retval = -1; + ret = -1; } else { @@ -1077,11 +1078,17 @@ fhandler_pty_master::close () int fhandler_pty_master::write (const void *ptr, size_t len) { - size_t i; + int i; char *p = (char *) ptr; - for (i=0; i<len; i++) - if (line_edit (p++, 1) == line_edit_error) + for (i=0; i < (int) len; i++) + { + line_edit_status status = line_edit (p++, 1); + if (status == line_edit_ok || status == line_edit_input_done) + continue; + if (status != line_edit_pipe_full) + i = -1; break; + } return i; } |