diff options
author | Richard Fitzgerald <rf@opensource.wolfsonmicro.com> | 2014-03-05 22:17:05 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-03-05 22:17:05 +0000 |
commit | aeee2c6a19b9d3765f72bc79555005786a424233 (patch) | |
tree | 1b192aa077560200400b7247f04360befb9f92c4 | |
parent | 56d8daedc9f26ed2c3e6b4328364654621a4fbbb (diff) | |
parent | d848221e947b4a71fe47423c60461b0a031aabc8 (diff) | |
download | tinycompress-aeee2c6a19b9d3765f72bc79555005786a424233.tar.gz |
am d848221e: compress: compress_wait() must return error if timed outandroid-l-preview_r2l-preview
* commit 'd848221e947b4a71fe47423c60461b0a031aabc8':
compress: compress_wait() must return error if timed out
-rw-r--r-- | compress.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -616,15 +616,17 @@ int compress_wait(struct compress *compress, int timeout_ms) fds.events = POLLOUT | POLLIN; ret = poll(&fds, 1, timeout_ms); - if (fds.revents & POLLERR) { - return oops(compress, EIO, "poll returned error!"); + if (ret > 0) { + if (fds.revents & POLLERR) + return oops(compress, EIO, "poll returned error!"); + if (fds.revents & (POLLOUT | POLLIN)) + return 0; } - /* A pause will cause -EBADFD or zero. */ - if ((ret < 0) && (ret != -EBADFD)) + if (ret == 0) + return oops(compress, ETIME, "poll timed out"); + if (ret < 0) return oops(compress, errno, "poll error"); - if (fds.revents & (POLLOUT | POLLIN)) { - return 0; - } - return ret; + + return oops(compress, EIO, "poll signalled unhandled event"); } |