mirror of
https://git.sr.ht/~sircmpwn/gmnisrv
synced 2024-11-03 06:07:17 -05:00
Don't memmove one past clients
This commit is contained in:
parent
d20caf389b
commit
7aedbed774
@ -197,7 +197,9 @@ disconnect_client(struct gmnisrv_server *server, struct gmnisrv_client *client)
|
||||
free(client->path);
|
||||
|
||||
size_t index = (client - server->clients) / sizeof(struct gmnisrv_client);
|
||||
memmove(client, &client[1], &server->clients[server->clientsz] - client);
|
||||
memmove(&server->clients[index],
|
||||
&server->clients[index + 1],
|
||||
(server->clientsz - (index + 1)) * sizeof(struct gmnisrv_client));
|
||||
memmove(&server->fds[server->nlisten + index],
|
||||
&server->fds[server->nlisten + index + 1],
|
||||
(server->fdsz - (server->nlisten + index + 1)) * sizeof(struct pollfd));
|
||||
|
Loading…
Reference in New Issue
Block a user