Commit f95ad612 authored by Mathias Haage's avatar Mathias Haage
Browse files

Fix writen

parent 22a03a0e
......@@ -152,7 +152,16 @@ int client_write_string(struct client* client)
int client_writen(struct client* client, size_t n)
{
return write(client->connfd, client->sendBuff, n);
size_t written = 0;
while (written < n) {
ssize_t tmp = write(client->connfd, client->sendBuff, n-written);
if (tmp < 0) {
perror("writen ERROR");
return tmp;
}
written += tmp;
}
return written;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment