mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 01:05:54 +08:00
Fix a readline bug. If a NUL is received, it would return end-of-file
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5633 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -528,7 +528,7 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen
|
||||
* return what we have.
|
||||
*/
|
||||
|
||||
else if (filep->f_oflags & O_NONBLOCK)
|
||||
else if ((filep->f_oflags & O_NONBLOCK) != 0)
|
||||
{
|
||||
/* If nothing was transferred, then return the -EAGAIN
|
||||
* error (not zero which means end of file).
|
||||
@@ -560,7 +560,7 @@ static ssize_t uart_read(FAR struct file *filep, FAR char *buffer, size_t buflen
|
||||
* wait.
|
||||
*/
|
||||
|
||||
else if (filep->f_oflags & O_NONBLOCK)
|
||||
else if ((filep->f_oflags & O_NONBLOCK) != 0)
|
||||
{
|
||||
/* Break out of the loop returning -EAGAIN */
|
||||
|
||||
@@ -1109,7 +1109,9 @@ void uart_connected(FAR uart_dev_t *dev, bool connected)
|
||||
{
|
||||
irqstate_t flags;
|
||||
|
||||
/* Is the device disconnected? */
|
||||
/* Is the device disconnected? Interrupts are disabled because this
|
||||
* function may be called from interrupt handling logic.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
dev->disconnected = !connected;
|
||||
|
||||
Reference in New Issue
Block a user