watcher: Remove unnecessary pending flag

This was added with 5ce3c9b15a ("watcher: Rebuild fdset when select()
fails"), i.e. before switching to poll(), solely to suppress errors when
FDs are closed and select() would return with an error.  With poll()
this should not happen result in an error (it potentially indicates this
via POLLNVAL in revents of that FD in the array).

Because the flag was not consistently changed/read with the mutex held,
some analysis tools got confused and imagined wild deadlock scenarios.
This commit is contained in:
Tobias Brunner
2026-07-21 10:37:43 +02:00
parent 87bbfe4f5f
commit f5aeba0f02
+3 -12
View File
@@ -56,11 +56,6 @@ struct private_watcher_t {
*/
u_int count;
/**
* Pending update of FD list?
*/
bool pending;
/**
* Running state of watcher
*/
@@ -177,7 +172,6 @@ static void update_and_unlock(private_watcher_t *this)
char buf[1] = { 'u' };
int error = 0;
this->pending = TRUE;
if (this->notify[1] != -1)
{
if (write(this->notify[1], buf, sizeof(buf)) == -1)
@@ -461,7 +455,6 @@ static job_requeue_t watch(private_watcher_t *this)
break;
}
}
this->pending = FALSE;
DBG2(DBG_WCH, "watcher got notification, rebuilding");
break;
}
@@ -521,12 +514,10 @@ static job_requeue_t watch(private_watcher_t *this)
break;
}
}
else
else if (errno != EINTR)
{
if (!this->pending && errno != EINTR)
{ /* complain only if no pending updates */
DBG1(DBG_WCH, "watcher poll() error: %s", strerror(errno));
}
/* rebuild FDSET on errors, just retry if interrupted */
DBG1(DBG_WCH, "watcher poll() error: %s", strerror(errno));
break;
}
}