diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-10 00:46:27 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2013-02-10 00:46:27 +0000 |
commit | f0fef8e21fd0459b75b3e5faf318634e5befbdaf (patch) | |
tree | d9451e3904a1b2e84bce6b183ccaca719b78ff51 /nuttx/drivers/serial | |
parent | 9768bf44e8f274eecc92f4eefbf0496f32649196 (diff) | |
download | px4-nuttx-f0fef8e21fd0459b75b3e5faf318634e5befbdaf.tar.gz px4-nuttx-f0fef8e21fd0459b75b3e5faf318634e5befbdaf.tar.bz2 px4-nuttx-f0fef8e21fd0459b75b3e5faf318634e5befbdaf.zip |
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
Diffstat (limited to 'nuttx/drivers/serial')
-rw-r--r-- | nuttx/drivers/serial/serial.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/nuttx/drivers/serial/serial.c b/nuttx/drivers/serial/serial.c index aaec71202..e723fb336 100644 --- a/nuttx/drivers/serial/serial.c +++ b/nuttx/drivers/serial/serial.c @@ -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; |