Skip to content

Commit

Permalink
GUACAMOLE-1846: Fix __write_all() to return length as documented.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmuehlner committed Aug 23, 2023
1 parent f8c082b commit b6338a0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/guacd/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,14 @@
static int __write_all(int fd, char* buffer, int length) {

/* Repeatedly write() until all data is written */
while (length > 0) {
int remaining_length = length;
while (remaining_length > 0) {

int written = write(fd, buffer, length);
int written = write(fd, buffer, remaining_length);
if (written < 0)
return -1;

length -= written;
remaining_length -= written;
buffer += written;

}
Expand Down

0 comments on commit b6338a0

Please sign in to comment.