summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-21 06:38:26 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-21 06:38:26 -0600
commita60c245e0abfe0762f64aaff4e800a750c3f6759 (patch)
treefe2a5c928571fdd760fcf6d6b34a2a303093d73d
parent676a6c1ea418bc55ed0fe598288ae63491e2cfa7 (diff)
downloadnuttx-a60c245e0abfe0762f64aaff4e800a750c3f6759.tar.gz
nuttx-a60c245e0abfe0762f64aaff4e800a750c3f6759.tar.bz2
nuttx-a60c245e0abfe0762f64aaff4e800a750c3f6759.zip
vfs/poll: add proper handling for sem_timedwait errnos. From Jussi Kivilinna
-rw-r--r--nuttx/fs/vfs/fs_poll.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/nuttx/fs/vfs/fs_poll.c b/nuttx/fs/vfs/fs_poll.c
index 26f1ebd21..a7fd5ed62 100644
--- a/nuttx/fs/vfs/fs_poll.c
+++ b/nuttx/fs/vfs/fs_poll.c
@@ -334,6 +334,22 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
}
ret = sem_timedwait(&sem, &abstime);
+ if (ret < 0)
+ {
+ int err = get_errno();
+
+ if (err == ETIMEDOUT)
+ {
+ /* Return zero (OK) in the event of a timeout */
+
+ ret = OK;
+ }
+ else
+ {
+ ret = -err;
+ }
+ }
+
irqrestore(flags);
}
else