From b84a6e0aa53fb0e17eabade7dd624b2090655eb0 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Wed, 15 Feb 2023 19:49:16 +0000 Subject: [PATCH] fix poll() to not mutate its parameter --- pkgs/tufted/tftp.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/tufted/tftp.lua b/pkgs/tufted/tftp.lua index 41ac627..92f2f9b 100644 --- a/pkgs/tufted/tftp.lua +++ b/pkgs/tufted/tftp.lua @@ -84,12 +84,14 @@ local poll = (function() if timedout then return nil end local ready = {} for _, fd in ipairs(readable) do - fds[fd].readable = true + ready[fd] = ready[fd] or { fd = fd } + ready[fd].readable = true end for _, fd in ipairs(writeable) do - fds[fd].writeable = true + ready[fd] = ready[fd] or { fd = fd } + ready[fd].writeable = true end - return fds + return ready end end)()