fs/vfs/fs_poll.c: Fix handling of sem_tickwait() return value sem_tickwait() does not return an -1+errno, it returns a negated errno value. Noted by Freddie Chopin.
This commit is contained in:
parent
fd896330d8
commit
7d6c2d150d
|
@ -11402,3 +11402,6 @@
|
|||
Rename the x86 up_spiinitialize() to i486_spibus_intialize(),
|
||||
Rename the z16f up_spiinitialize() to z16_spibus_intialize().
|
||||
up_spiinitialize() has been completely eliminated. (2016-01-27).
|
||||
* fs/vfs/fs_poll.c: Fix handling of sem_tickwait() return value
|
||||
sem_tickwait() does not return an -1+errno, it returns a negated
|
||||
errno value. Noted by Freddie Chopin."
|
||||
|
|
2
configs
2
configs
|
@ -1 +1 @@
|
|||
Subproject commit b5e84e337c9dd2fdd722a6ea1411de3298d5bf50
|
||||
Subproject commit b7138e5722f34d752d80d2ea5e8de8f2f06497fe
|
|
@ -329,6 +329,7 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
|
|||
{
|
||||
sem_t sem;
|
||||
int count = 0;
|
||||
int err;
|
||||
int ret;
|
||||
|
||||
sem_init(&sem, 0, 0);
|
||||
|
@ -354,20 +355,14 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
|
|||
ret = sem_tickwait(&sem, clock_systimer(), MSEC2TICK(timeout));
|
||||
if (ret < 0)
|
||||
{
|
||||
int err = get_errno();
|
||||
|
||||
if (err == ETIMEDOUT)
|
||||
if (ret == -ETIMEDOUT)
|
||||
{
|
||||
/* Return zero (OK) in the event of a timeout */
|
||||
|
||||
ret = OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* EINTR is the only other error expected in normal operation */
|
||||
|
||||
ret = -err;
|
||||
}
|
||||
/* EINTR is the only other error expected in normal operation */
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -379,9 +374,15 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
|
|||
|
||||
/* Teardown the poll operation and get the count of events. Zero will be
|
||||
* returned in the case of a timeout.
|
||||
*
|
||||
* Preserve ret, if negative, since it holds the result of the wait.
|
||||
*/
|
||||
|
||||
ret = poll_teardown(fds, nfds, &count, ret);
|
||||
err = poll_teardown(fds, nfds, &count, ret);
|
||||
if (err < 0 && ret == OK)
|
||||
{
|
||||
ret = err;
|
||||
}
|
||||
}
|
||||
|
||||
sem_destroy(&sem);
|
||||
|
|
Loading…
Reference in New Issue