Browse Source

Hotfix: discard NUL characters in readline, rather than faking EOF on the console.

sbg
px4dev 12 years ago
parent
commit
a11a71ec9c
  1. 18
      apps/system/readline/readline.c

18
apps/system/readline/readline.c

@ -126,7 +126,7 @@ static inline int readline_rawgetc(int infd) @@ -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) @@ -154,13 +154,21 @@ static inline int readline_rawgetc(int infd)
{
return -errcode;
}
continue;
}
}
while (nread < 1);
/* On success, return the character that was read */
else if (buffer == '\0')
{
/* Ignore NUL characters, since they look like EOF to our caller */
return (int)buffer;
continue;
}
/* Success, return the character that was read */
return (int)buffer;
}
}
/****************************************************************************

Loading…
Cancel
Save