diff options
| author | Bernard Xiong <[email protected]> | 2020-06-01 15:32:53 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2020-06-01 15:32:53 +0800 |
| commit | a6a8b90935cde342cfdcee1c4de7aa1b70cab65d (patch) | |
| tree | 0139492f7ba674f5214b96d025dd81440135913d /components/dfs/src | |
| parent | 7c761516aa24272e44f1371264096a90be41dd5e (diff) | |
| parent | d75f03e4b03be4c72c5155cc0b00683da31ae74b (diff) | |
Merge pull request #3618 from longtengmcu/master
fix three bugs about ethernet
Diffstat (limited to 'components/dfs/src')
| -rw-r--r-- | components/dfs/src/poll.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/components/dfs/src/poll.c b/components/dfs/src/poll.c index 3f304549f7..fc48eca758 100644 --- a/components/dfs/src/poll.c +++ b/components/dfs/src/poll.c @@ -137,6 +137,14 @@ static int do_pollfd(struct pollfd *pollfd, rt_pollreq_t *req) req->_key = pollfd->events | POLLERR | POLLHUP; mask = f->fops->poll(f, req); + + /* dealwith the device return error -1*/ + if (mask < 0) + { + fd_put(f); + pollfd->revents = 0; + return mask; + } } /* Mask out unneeded events. */ mask &= pollfd->events | POLLERR | POLLHUP; @@ -154,6 +162,7 @@ static int poll_do(struct pollfd *fds, nfds_t nfds, struct rt_poll_table *pt, in int istimeout = 0; int n; struct pollfd *pf; + int ret = 0; if (msec == 0) { @@ -168,7 +177,14 @@ static int poll_do(struct pollfd *fds, nfds_t nfds, struct rt_poll_table *pt, in for (n = 0; n < nfds; n ++) { - if (do_pollfd(pf, &pt->req)) + ret = do_pollfd(pf, &pt->req); + if(ret < 0) + { + /*dealwith the device return error -1 */ + pt->req._proc = RT_NULL; + return ret; + } + else if(ret > 0) { num ++; pt->req._proc = RT_NULL; |
