chiark / gitweb /
util.c: ignore pollfd.revent for loop_read/loop_write
authorChen Jie <chenj@lemote.com>
Thu, 12 Sep 2013 01:21:41 +0000 (09:21 +0800)
committerLennart Poettering <lennart@poettering.net>
Tue, 1 Oct 2013 02:49:59 +0000 (04:49 +0200)
Let read()/write() report any error/EOF.

src/shared/util.c

index fb42d663a6cfc4cad91a9b0582af35d31eab4627..5dc605eb8d5480738246340e0faac4300a9621ab 100644 (file)
@@ -2186,8 +2186,10 @@ ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll) {
                                         return n > 0 ? n : -errno;
                                 }
 
-                                if (pollfd.revents != POLLIN)
-                                        return n > 0 ? n : -EIO;
+                                /* We knowingly ignore the revents value here,
+                                 * and expect that any error/EOF is reported
+                                 * via read()/write()
+                                 */
 
                                 continue;
                         }
@@ -2234,8 +2236,10 @@ ssize_t loop_write(int fd, const void *buf, size_t nbytes, bool do_poll) {
                                         return n > 0 ? n : -errno;
                                 }
 
-                                if (pollfd.revents != POLLOUT)
-                                        return n > 0 ? n : -EIO;
+                                /* We knowingly ignore the revents value here,
+                                 * and expect that any error/EOF is reported
+                                 * via read()/write()
+                                 */
 
                                 continue;
                         }