From f20a6709eaa7be3f2e3e4d0bf70e346781427c42 Mon Sep 17 00:00:00 2001 From: Martin Peres Date: Fri, 17 Jul 2015 17:21:26 +0300 Subject: [PATCH] os: make sure the clientsWritable fd_set is initialized before use In WaitForSomething(), the fd_set clientsWritable may be used unitialized when the boolean AnyClientsWriteBlocked is set in the WakeupHandler(). Fix this by zeroing the fd_set at the begining of WaitForSomething(). In this case, the bottom part of the loop will not do any work but the next call to select will result in the execution of the right codepath. This is exactly what we want because we need to know the writable clients before handling them. Reported-by: Karol Herbst Reported-by: Tobias Klausmann Signed-off-by: Martin Peres Tested-by: Martin Peres Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91316 Cc: Ilia Mirkin Cc: Martin Peres Cc: Olivier Fourdan Cc: Alan Coopersmith --- os/WaitFor.c | 1 + 1 file changed, 1 insertion(+) diff --git a/os/WaitFor.c b/os/WaitFor.c index 431f1a6..993c14e 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -158,6 +158,7 @@ WaitForSomething(int *pClientsReady) Bool someReady = FALSE; FD_ZERO(&clientsReadable); + FD_ZERO(&clientsWritable); if (nready) SmartScheduleStopTimer(); -- 2.4.5