Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/lineedit.c')
-rw-r--r--libbb/lineedit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index f65e852b1..4253054c5 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -1211,7 +1211,7 @@ static void parse_prompt(const char *prmt_ptr)
#endif
#define setTermSettings(fd, argp) tcsetattr(fd, TCSANOW, argp)
-#define getTermSettings(fd, argp) tcgetattr(fd, argp);
+#define getTermSettings(fd, argp) tcgetattr(fd, argp)
static sighandler_t previous_SIGWINCH_handler;
@@ -1270,9 +1270,10 @@ int read_line_input(const char *prompt, char *command, int maxsize, line_input_t
smalluint prevc;
#endif
- getTermSettings(0, (void *) &initial_settings);
- /* Happens when e.g. stty -echo was run before */
- if (!(initial_settings.c_lflag & ECHO)) {
+ if (getTermSettings(0, (void *) &initial_settings) < 0
+ /* Happens when e.g. stty -echo was run before */
+ || !(initial_settings.c_lflag & ECHO)
+ ) {
parse_prompt(prompt);
fflush(stdout);
fgets(command, maxsize, stdin);