From a11a71ec9c1b04cd5ca515862605008038804c8d Mon Sep 17 00:00:00 2001 From: px4dev Date: Sun, 24 Feb 2013 10:54:22 -0800 Subject: [PATCH] Hotfix: discard NUL characters in readline, rather than faking EOF on the console. --- apps/system/readline/readline.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/apps/system/readline/readline.c b/apps/system/readline/readline.c index bac7eee8c5..a8240a62a9 100644 --- a/apps/system/readline/readline.c +++ b/apps/system/readline/readline.c @@ -126,7 +126,7 @@ static inline int readline_rawgetc(int infd) * error occurs). */ - do + for (;;) { /* Read one character from the incoming stream */ @@ -154,13 +154,21 @@ static inline int readline_rawgetc(int infd) { return -errcode; } + + continue; } + + else if (buffer == '\0') + { + /* Ignore NUL characters, since they look like EOF to our caller */ + + continue; + } + + /* Success, return the character that was read */ + + return (int)buffer; } - while (nread < 1); - - /* On success, return the character that was read */ - - return (int)buffer; } /****************************************************************************