This patch fixes an issue in unix socket handling. It is possible
that a socket did disconnect when analysing a command and because
the data treatment is done in a loop on clients this was leading
to a update of the list of clients during the loop. So we need
in fact to use TAILQ_FOREACH_SAFE instead of TAILQ_FOREACH.
Reported-by: Luigi Sandon <luigi.sandon@gmail.com>
Fix-suggested-by: Luigi Sandon <luigi.sandon@gmail.com>
int ret;
fd_set select_set;
UnixClient *uclient;
+ UnixClient *tclient;
/* Wait activity on the socket */
FD_ZERO(&select_set);
return 1;
}
- TAILQ_FOREACH(uclient, &this->clients, next) {
+ TAILQ_FOREACH_SAFE(uclient, &this->clients, next, tclient) {
if (FD_ISSET(uclient->fd, &select_set)) {
UnixCommandRun(this, uclient);
}