summaryrefslogtreecommitdiff
path: root/tools/lib/api/fd/array.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lib/api/fd/array.c')
-rw-r--r--tools/lib/api/fd/array.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/lib/api/fd/array.c b/tools/lib/api/fd/array.c
index f0f195207fca..ffe8272af59b 100644
--- a/tools/lib/api/fd/array.c
+++ b/tools/lib/api/fd/array.c
@@ -122,6 +122,12 @@ int fdarray__filter(struct fdarray *fda, short revents,
if (entry_destructor)
entry_destructor(fda, fd, arg);
+ /*
+ * Set fd to -1 so poll() ignores this entry; otherwise
+ * POLLHUP/POLLERR are still reported for events=0 fds
+ * (POSIX: always checked), causing a poll storm.
+ */
+ fda->entries[fd].fd = -1;
fda->entries[fd].revents = fda->entries[fd].events = 0;
continue;
}