svn commit: trunk/busybox/miscutils

vda at busybox.net vda at busybox.net
Fri Oct 31 03:04:55 UTC 2008


Author: vda
Date: 2008-10-30 20:04:55 -0700 (Thu, 30 Oct 2008)
New Revision: 23874

Log:
less: fix newly-introduced case of less spinning forever
 on pty's closed etc



Modified:
   trunk/busybox/miscutils/less.c


Changeset:
Modified: trunk/busybox/miscutils/less.c
===================================================================
--- trunk/busybox/miscutils/less.c	2008-10-31 02:37:18 UTC (rev 23873)
+++ trunk/busybox/miscutils/less.c	2008-10-31 03:04:55 UTC (rev 23874)
@@ -853,12 +853,16 @@
 	/* We have kbd_fd in O_NONBLOCK mode, read inside read_key()
 	 * would not block even if there is no input available */
 	rd = read_key(kbd_fd, NULL, input);
-	if (rd == -1 && errno == EAGAIN) {
-		/* No keyboard input available. Since poll() did return,
-		 * we should have input on stdin */
-		read_lines();
-		buffer_fill_and_print();
-		goto again;
+	if (rd == -1) {
+		if (errno == EAGAIN) {
+			/* No keyboard input available. Since poll() did return,
+			 * we should have input on stdin */
+			read_lines();
+			buffer_fill_and_print();
+			goto again;
+		}
+		/* EOF/error (ssh session got killed etc) */
+		less_exit(0);
 	}
 	set_tty_cooked();
 	return rd;




More information about the busybox-cvs mailing list