diff options
Diffstat (limited to '')
-rw-r--r-- | main.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -51,7 +51,14 @@ void *client_loop(void *ign) { while (1) { char data[512]; pthread_mutex_unlock(&send_lock); // TODO: proper locking, this works for now but is certainly inefficient - uint64_t new_len = read(client_fd, data, 512); + uint64_t new_len; + { + ssize_t len = read(client_fd, data, 512); + if (len < 0) + new_len = 0; + else + new_len = len; + } pthread_mutex_lock(&send_lock); if (new_len == 0) { |