From aa93c81564849e7e4b47b7b96f41e3934c5ec77f Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Tue, 16 Aug 2016 18:09:31 -0400 Subject: [PATCH] Close the fd that we're removing from the pollfds list We currently dup the file descriptor in add() by calling consume_fd(). We never close this dup'd fd. We should close it when we remove it from the pollfds list. --- src/platform/linux/mod.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platform/linux/mod.rs b/src/platform/linux/mod.rs index 9c5f0f5dd..656c12bf7 100644 --- a/src/platform/linux/mod.rs +++ b/src/platform/linux/mod.rs @@ -439,6 +439,9 @@ impl OsIpcReceiverSet { } Err(err) if err.channel_is_closed() => { hangups.insert(pollfd.fd); + unsafe { + libc::close(pollfd.fd); + } selection_results.push(OsIpcSelectionResult::ChannelClosed( pollfd.fd as i64)) }