diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-11-21 06:38:26 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-11-21 06:38:26 -0600 |
commit | a60c245e0abfe0762f64aaff4e800a750c3f6759 (patch) | |
tree | fe2a5c928571fdd760fcf6d6b34a2a303093d73d | |
parent | 676a6c1ea418bc55ed0fe598288ae63491e2cfa7 (diff) | |
download | nuttx-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.c | 16 |
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 |