diff options
author | Denys Vlasenko | 2009-09-29 00:00:12 +0200 |
---|---|---|
committer | Denys Vlasenko | 2009-09-29 00:00:12 +0200 |
commit | 2f3f09c287f43dcad50b740793c2b467f166c058 (patch) | |
tree | 060c93df91102b1dda2815060ef71a769a5ddbfe | |
parent | db9c57eed1db2fd53bfd653efcf19210e5b14080 (diff) | |
download | busybox-2f3f09c287f43dcad50b740793c2b467f166c058.zip busybox-2f3f09c287f43dcad50b740793c2b467f166c058.tar.gz |
libbb/lineedit: restore ^D handling for unicode
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | libbb/lineedit.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 3689b4b..9b112bc 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -114,8 +114,8 @@ struct lineedit_statics { unsigned cmdedit_prmt_len; /* length of prompt (without colors etc) */ unsigned cursor; - unsigned command_len; - /* *int* maxsize: we want x in "if (x > S.maxsize)" + int command_len; /* must be signed */ + /* signed maxsize: we want x in "if (x > S.maxsize)" * to _not_ be promoted to unsigned */ int maxsize; CHAR_T *command_ps; @@ -2124,7 +2124,9 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li #undef command #if ENABLE_FEATURE_ASSUME_UNICODE - command_len = save_string(command, maxsize - 1); + command[0] = '\0'; + if (command_len > 0) + command_len = save_string(command, maxsize - 1); free(command_ps); #endif |