From 854f3a54d23485aff14faf2d7c9fc81e335d5d66 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 26 Nov 1993 21:54:39 +0000 Subject: [PATCH] (kbd_buffer_get_event): If user destroys the last frame, exit before calling Fdelete_frame. (read_avail_input): Undo Nov 18 change. --- src/keyboard.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/keyboard.c b/src/keyboard.c index 166b8b54779..d82ae463ce3 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1944,12 +1944,13 @@ kbd_buffer_get_event () { Lisp_Object value; - Fdelete_frame (event->frame_or_window, Qt); - kbd_fetch_ptr = event + 1; - + /* If the user destroys the only frame, Emacs should exit. */ value = Fvisible_frame_list (); - if (! CONSP (value)) + if (! CONSP (value) || ! CONSP (XCONS (value)->cdr)) kill (getpid (), SIGHUP); + + Fdelete_frame (event->frame_or_window, Qt); + kbd_fetch_ptr = event + 1; } #endif /* Just discard these, by returning nil. @@ -3072,26 +3073,25 @@ read_avail_input (expected) /* Now read; for one reason or another, this will not block. */ while (1) { - int value = read (fileno (stdin), cbuf, nread); + nread = read (fileno (stdin), cbuf, nread); #ifdef AIX /* The kernel sometimes fails to deliver SIGHUP for ptys. This looks incorrect, but it isn't, because _BSD causes O_NDELAY to be defined in fcntl.h as O_NONBLOCK, and that causes a value other than 0 when there is no input. */ - if (value == 0) + if (nread == 0) kill (SIGHUP, 0); #endif + /* This code is wrong, but at least it gets the right results. + Fix it for 19.23. */ /* Retry the read if it is interrupted. */ - if (value >= 0 + if (nread >= 0 || ! (errno == EAGAIN || errno == EFAULT #ifdef EBADSLT || errno == EBADSLT #endif )) - { - nread = value; - break; - } + break; } #ifndef FIONREAD -- 2.39.5