From cf7658b4cd9e54813061011b959f272cef53e251 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 18 Feb 2020 21:16:38 +0100 Subject: [PATCH] event-loop: Fix debug-log "failed to delete fd # from epoll watch list" spam The boot server uses a disconnect handler which closes the fd, this causes deleting the fd from the epoll watch list to fail with an EBADF error. Since the fd was closed it was already removed from the epoll watch list, so the failure is harmless, silence these errors getting logged to the debug logs. Signed-off-by: Hans de Goede --- src/libply/ply-event-loop.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libply/ply-event-loop.c b/src/libply/ply-event-loop.c index 0e8ad7c8..5eb601cc 100644 --- a/src/libply/ply-event-loop.c +++ b/src/libply/ply-event-loop.c @@ -641,7 +641,11 @@ ply_event_loop_remove_source_node (ply_event_loop_t *loop, status = epoll_ctl (loop->epoll_fd, EPOLL_CTL_DEL, source->fd, NULL); - if (status < 0) + /* + * EBADF means that there was a disconnect handler, which has + * closed the fd, which is fine, do not log an error for this. + */ + if (status < 0 && errno != EBADF) ply_trace ("failed to delete fd %d from epoll watch list: %m", source->fd); source->is_getting_polled = false; } -- 2.47.3