mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 19:36:35 +08:00
vfs/poll: correct the return event if inode has closed
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
+8
-1
@@ -299,7 +299,7 @@ int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
|||||||
FAR struct inode *inode;
|
FAR struct inode *inode;
|
||||||
int ret = -ENOSYS;
|
int ret = -ENOSYS;
|
||||||
|
|
||||||
DEBUGASSERT(filep != NULL && filep->f_inode != NULL);
|
DEBUGASSERT(filep != NULL);
|
||||||
inode = filep->f_inode;
|
inode = filep->f_inode;
|
||||||
|
|
||||||
if (inode != NULL)
|
if (inode != NULL)
|
||||||
@@ -337,6 +337,13 @@ int file_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
|||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fds->revents |= (POLLERR | POLLHUP);
|
||||||
|
nxsem_post(fds->sem);
|
||||||
|
|
||||||
|
ret = OK;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user