From bfbbe3db14b513ea49d49ae870a82b24a9d6fcef Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 2 Mar 2018 11:13:47 +0530 Subject: [PATCH] mutex remove_poll_fd() It modifies talk_data.fds which can also be modified from the main thread when adding a writer. --- kitty/child-monitor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index cba897151..d73abdc3b 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -1049,6 +1049,7 @@ read_from_peer(ChildMonitor *self, int s) { static inline void remove_poll_fd(int fd) { + peer_mutex(lock); size_t count = talk_data.num_talk_fds + talk_data.num_listen_fds; for (size_t i = talk_data.num_listen_fds; i < count; i++) { struct pollfd *pfd = talk_data.fds + i; @@ -1059,6 +1060,7 @@ remove_poll_fd(int fd) { break; } } + peer_mutex(unlock); } static inline void