drivers/serial/pty.c: Fix coverity issue
Coverity report that `ntotal` may be a negative value. Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
e1096bd35c
commit
23ad4700a9
@ -471,7 +471,7 @@ static ssize_t pty_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||||||
ntotal = file_read(&dev->pd_src, buffer, len);
|
ntotal = file_read(&dev->pd_src, buffer, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->pd_lflag & ECHO)
|
if ((dev->pd_lflag & ECHO) && (ntotal > 0))
|
||||||
{
|
{
|
||||||
pty_write(filep, buffer, ntotal);
|
pty_write(filep, buffer, ntotal);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user