svn commit: trunk/busybox/shell

vda at busybox.net vda at busybox.net
Sat Feb 2 18:50:50 UTC 2008


Author: vda
Date: 2008-02-02 10:50:50 -0800 (Sat, 02 Feb 2008)
New Revision: 20933

Log:
msh: also handle EOF/read errors correctly



Modified:
   trunk/busybox/shell/msh.c


Changeset:
Modified: trunk/busybox/shell/msh.c
===================================================================
--- trunk/busybox/shell/msh.c	2008-02-02 18:35:55 UTC (rev 20932)
+++ trunk/busybox/shell/msh.c	2008-02-02 18:50:50 UTC (rev 20933)
@@ -4836,11 +4836,11 @@
 		static int position = 0, size = 0;
 
 		while (size == 0 || position >= size) {
-			/* Repeat if Ctrl-C is pressed. TODO: exit on -1 (error/EOF)? */
-			while (read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state) == 0)
-				continue;
-			size = strlen(filechar_cmdbuf);
+			size = read_line_input(current_prompt, filechar_cmdbuf, BUFSIZ, line_input_state);
+			if (size < 0) /* Error/EOF */
+				exit(0);
 			position = 0;
+			/* if Ctrl-C, size == 0 and loop will repeat */
 		}
 		c = filechar_cmdbuf[position];
 		position++;




More information about the busybox-cvs mailing list