am d848221e: compress: compress_wait() must return error if timed out
* commit 'd848221e947b4a71fe47423c60461b0a031aabc8':
compress: compress_wait() must return error if timed out
diff --git a/compress.c b/compress.c
index 5cd0966..d1a2283 100644
--- a/compress.c
+++ b/compress.c
@@ -616,15 +616,17 @@
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");
}