forked from aniani/gmnisrv
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);
|
free(client->path);
|
||||||
|
|
||||||
size_t index = (client - server->clients) / sizeof(struct gmnisrv_client);
|
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],
|
memmove(&server->fds[server->nlisten + index],
|
||||||
&server->fds[server->nlisten + index + 1],
|
&server->fds[server->nlisten + index + 1],
|
||||||
(server->fdsz - (server->nlisten + index + 1)) * sizeof(struct pollfd));
|
(server->fdsz - (server->nlisten + index + 1)) * sizeof(struct pollfd));
|
||||||
|
Loading…
Reference in New Issue
Block a user