svn commit: trunk/busybox: libbb shell
vda at busybox.net
vda at busybox.net
Sun Dec 9 10:03:31 UTC 2007
Author: vda
Date: 2007-12-09 02:03:28 -0800 (Sun, 09 Dec 2007)
New Revision: 20631
Log:
lineedit: don't violate API if we do simple fgets
ash: cosmetic style fixes, no code changes
Modified:
trunk/busybox/libbb/lineedit.c
trunk/busybox/shell/ash.c
Changeset:
Modified: trunk/busybox/libbb/lineedit.c
===================================================================
--- trunk/busybox/libbb/lineedit.c 2007-12-09 04:13:43 UTC (rev 20630)
+++ trunk/busybox/libbb/lineedit.c 2007-12-09 10:03:28 UTC (rev 20631)
@@ -1343,8 +1343,10 @@
int len;
parse_and_put_prompt(prompt);
fflush(stdout);
- fgets(command, maxsize, stdin);
- len = strlen(command);
+ if (fgets(command, maxsize, stdin) == NULL)
+ len = -1; /* EOF or error */
+ else
+ len = strlen(command);
DEINIT_S();
return len;
}
Modified: trunk/busybox/shell/ash.c
===================================================================
--- trunk/busybox/shell/ash.c 2007-12-09 04:13:43 UTC (rev 20630)
+++ trunk/busybox/shell/ash.c 2007-12-09 10:03:28 UTC (rev 20631)
@@ -8553,7 +8553,7 @@
goto retry;
}
if (nr < 0 && errno == 0) {
- /* Ctrl+D presend */
+ /* Ctrl+D pressed */
nr = 0;
}
}
@@ -8564,8 +8564,8 @@
if (nr < 0) {
if (parsefile->fd == 0 && errno == EWOULDBLOCK) {
int flags = fcntl(0, F_GETFL);
- if (flags >= 0 && flags & O_NONBLOCK) {
- flags &=~ O_NONBLOCK;
+ if (flags >= 0 && (flags & O_NONBLOCK)) {
+ flags &= ~O_NONBLOCK;
if (fcntl(0, F_SETFL, flags) >= 0) {
out2str("sh: turning off NDELAY mode\n");
goto retry;
More information about the busybox-cvs
mailing list