aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-12-09 10:03:28 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-12-09 10:03:28 +0000
commit9cb220be9dea5417c1ad0091bb7eeb1371891f89 (patch)
tree33e6f2cb5996d5cbf73b1d8fbdbfe955c847cbad
parenta96425fe827c603b9c576c95f12b885af68eb219 (diff)
downloadbusybox-w32-9cb220be9dea5417c1ad0091bb7eeb1371891f89.tar.gz
busybox-w32-9cb220be9dea5417c1ad0091bb7eeb1371891f89.tar.bz2
busybox-w32-9cb220be9dea5417c1ad0091bb7eeb1371891f89.zip
lineedit: don't violate API if we do simple fgets
ash: cosmetic style fixes, no code changes
-rw-r--r--libbb/lineedit.c6
-rw-r--r--shell/ash.c6
2 files changed, 7 insertions, 5 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 1397409cc..a0f190fd4 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -1343,8 +1343,10 @@ int read_line_input(const char *prompt, char *command, int maxsize, line_input_t
1343 int len; 1343 int len;
1344 parse_and_put_prompt(prompt); 1344 parse_and_put_prompt(prompt);
1345 fflush(stdout); 1345 fflush(stdout);
1346 fgets(command, maxsize, stdin); 1346 if (fgets(command, maxsize, stdin) == NULL)
1347 len = strlen(command); 1347 len = -1; /* EOF or error */
1348 else
1349 len = strlen(command);
1348 DEINIT_S(); 1350 DEINIT_S();
1349 return len; 1351 return len;
1350 } 1352 }
diff --git a/shell/ash.c b/shell/ash.c
index 9b9fe5b6d..4c8a28911 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8553,7 +8553,7 @@ preadfd(void)
8553 goto retry; 8553 goto retry;
8554 } 8554 }
8555 if (nr < 0 && errno == 0) { 8555 if (nr < 0 && errno == 0) {
8556 /* Ctrl+D presend */ 8556 /* Ctrl+D pressed */
8557 nr = 0; 8557 nr = 0;
8558 } 8558 }
8559 } 8559 }
@@ -8564,8 +8564,8 @@ preadfd(void)
8564 if (nr < 0) { 8564 if (nr < 0) {
8565 if (parsefile->fd == 0 && errno == EWOULDBLOCK) { 8565 if (parsefile->fd == 0 && errno == EWOULDBLOCK) {
8566 int flags = fcntl(0, F_GETFL); 8566 int flags = fcntl(0, F_GETFL);
8567 if (flags >= 0 && flags & O_NONBLOCK) { 8567 if (flags >= 0 && (flags & O_NONBLOCK)) {
8568 flags &=~ O_NONBLOCK; 8568 flags &= ~O_NONBLOCK;
8569 if (fcntl(0, F_SETFL, flags) >= 0) { 8569 if (fcntl(0, F_SETFL, flags) >= 0) {
8570 out2str("sh: turning off NDELAY mode\n"); 8570 out2str("sh: turning off NDELAY mode\n");
8571 goto retry; 8571 goto retry;