]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Separate POLLERR and POLLNVAL for rsync poll
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 29 Aug 2024 22:33:40 +0000 (16:33 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Thu, 29 Aug 2024 22:34:31 +0000 (16:34 -0600)
POLLERR must induce close(), POLLNVAL must not.

src/rsync/rsync.c

index 049417b11dde869ea480e472e9cd2f6888cc6ca1..8dd281503d0d346df3e6cda35265e7bfb33f0bcd 100644 (file)
@@ -191,8 +191,12 @@ exhaust_read_fd(int fd, int type)
                        close(fd);
                        return 1;
                }
-               if (pfd[0].revents & (POLLERR|POLLNVAL)) {
+               if (pfd[0].revents & POLLNVAL) {
                        pr_val_err("rsync bad fd: %i", pfd[0].fd);
+                       return 1; /* Already closed */
+               } else if (pfd[0].revents & POLLERR) {
+                       pr_val_err("Generic error during rsync poll.");
+                       close(fd);
                        return 1;
                } else if (pfd[0].revents & (POLLIN|POLLHUP)) {
                        count = read(fd, buffer, sizeof(buffer));