From 5063c0e1a29078fb72ef5e48e1eeed6a863128ac Mon Sep 17 00:00:00 2001 From: Troels Nielsen Date: Fri, 23 Mar 2012 08:23:14 -0400 Subject: * src/process.c (wait_reading_process_output): Handle pty disconnect by refraining from sending oneself a SIGCHLD. Fixes: debbugs:10933 --- src/process.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/process.c') diff --git a/src/process.c b/src/process.c index bdf16b7dbd2..f2f33a9eafc 100644 --- a/src/process.c +++ b/src/process.c @@ -4888,15 +4888,20 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, It can't hurt. */ else if (nread == -1 && errno == EIO) { - /* Clear the descriptor now, so we only raise the signal once. */ - FD_CLR (channel, &input_wait_mask); - FD_CLR (channel, &non_keyboard_wait_mask); - - kill (getpid (), SIGCHLD); + /* Don't do anything if only a pty, with no associated + process (bug#10933). */ + if (XPROCESS (proc)->pid != -2) { + /* Clear the descriptor now, so we only raise the signal + once. */ + FD_CLR (channel, &input_wait_mask); + FD_CLR (channel, &non_keyboard_wait_mask); + + kill (getpid (), SIGCHLD); + } } #endif /* HAVE_PTYS */ - /* If we can detect process termination, don't consider the process - gone just because its pipe is closed. */ + /* If we can detect process termination, don't consider the + process gone just because its pipe is closed. */ #ifdef SIGCHLD else if (nread == 0 && !NETCONN_P (proc) && !SERIALCONN_P (proc)) ; -- cgit v1.2.1