1
0
forked from aniani/gmnisrv

Fix use of wrong index during pollfd refresh

The right side of the refresh ended up using the index of the deleted
client instead of the index from the loop, which happens to work when
the destroyed client is either last or second-last.
This commit is contained in:
Kenny Levinsen 2020-11-10 14:05:43 +01:00 committed by Drew DeVault
parent fdd27bb4c1
commit 9fd9eef9d7

View File

@ -211,7 +211,7 @@ disconnect_client(struct gmnisrv_server *server, struct gmnisrv_client *client)
--server->nclients; --server->nclients;
for (size_t idx = index; idx < server->nclients; idx++) { for (size_t idx = index; idx < server->nclients; idx++) {
server->clients[idx].pollfd = &server->fds[server->nlisten + index]; server->clients[idx].pollfd = &server->fds[server->nlisten + idx];
} }
} }