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

This commit is contained in:
px4dev 2013-02-24 10:54:22 -08:00
parent 8c7e2546ed
commit a11a71ec9c
1 changed files with 14 additions and 6 deletions

View File

@ -126,7 +126,7 @@ static inline int readline_rawgetc(int infd)
* error occurs). * error occurs).
*/ */
do for (;;)
{ {
/* Read one character from the incoming stream */ /* Read one character from the incoming stream */
@ -154,13 +154,21 @@ static inline int readline_rawgetc(int infd)
{ {
return -errcode; return -errcode;
} }
}
}
while (nread < 1);
/* On success, return the character that was read */ 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; return (int)buffer;
}
} }
/**************************************************************************** /****************************************************************************