From 71f50408e0230e260fe3c3643ae2916e15ec7ded Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Sun, 2 Jan 2000 23:52:49 +0000 Subject: [PATCH] 2000-01-02 viro@math.psu.edu * src/subshell.c: Reason: in feed_subshell() we are trying to read from shell pty,check for retval==-1 && errno != EIO. In that case we flame and exit. Otherwise we are trying to write what we've read. Good luck doing it if we got errno==EIO, which is _normal_ for situation when shell just died. Resulting write(1,foo,~0U) is somewhat excessively, erm, verbose. --- src/ChangeLog | 9 +++++++++ src/subshell.c | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/ChangeLog b/src/ChangeLog index d8a9c7205..e082c3517 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2000-01-02 viro@math.psu.edu + + * src/subshell.c: Reason: in feed_subshell() we are trying to read + from shell pty,check for retval==-1 && errno != EIO. In that case + we flame and exit. Otherwise we are trying to write what we've + read. Good luck doing it if we got errno==EIO, which is _normal_ + for situation when shell just died. Resulting write(1,foo,~0U) is + somewhat excessively, erm, verbose. + 1999-12-21 Pavel Roskin * src/main.c, src/view.c: #warning's replaced with FIXME's. diff --git a/src/subshell.c b/src/subshell.c index 6d0953ca4..6a0018a78 100644 --- a/src/subshell.c +++ b/src/subshell.c @@ -932,7 +932,14 @@ static int feed_subshell (int how, int fail_on_error) /* for (i=0; i<5; ++i) * FIXME -- experimental */ { bytes = read (subshell_pty, pty_buffer, pty_buffer_size); - if (bytes == -1 && errno != EIO) + /* Patch from viro@math.psu.edu + * add by MichaelBramer (Debian MC-Maintainer */ + if (bytes == -1 && errno == EIO && !subshell_alive) + { + return FALSE; + } + if (bytes == -1) + /* end from the patch */ { tcsetattr (STDOUT_FILENO, TCSANOW, &shell_mode); perror ("\n"__FILE__": read (subshell_pty...)");