aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-12-09 10:03:28 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2007-12-09 10:03:28 +0000
commit9cb220be9dea5417c1ad0091bb7eeb1371891f89 (patch)
tree33e6f2cb5996d5cbf73b1d8fbdbfe955c847cbad /libbb
parenta96425fe827c603b9c576c95f12b885af68eb219 (diff)
downloadbusybox-9cb220be9dea5417c1ad0091bb7eeb1371891f89.tar.gz
busybox-9cb220be9dea5417c1ad0091bb7eeb1371891f89.tar.bz2
lineedit: don't violate API if we do simple fgets
ash: cosmetic style fixes, no code changes
Diffstat (limited to 'libbb')
-rw-r--r--libbb/lineedit.c6
1 files changed, 4 insertions, 2 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
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;
}