Commit 7352c7d7 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fix handling of EOF and EINTR on local read.

Thanks to Julien Cristau.
parent 9cfeb608
...@@ -633,16 +633,22 @@ main(int argc, char **argv) ...@@ -633,16 +633,22 @@ main(int argc, char **argv)
} }
} }
for(i = 0; i < num_local_sockets; i++) { i = 0;
while(i < num_local_sockets) {
if(FD_ISSET(local_sockets[i], &readfds)) { if(FD_ISSET(local_sockets[i], &readfds)) {
rc = local_read(local_sockets[i]); rc = local_read(local_sockets[i]);
if(rc <= 0) { if(rc <= 0) {
if(rc < 0) if(rc < 0) {
if(errno == EINTR)
continue;
perror("read(local_socket)"); perror("read(local_socket)");
}
close(local_sockets[i]); close(local_sockets[i]);
local_sockets[i] = local_sockets[--num_local_sockets]; local_sockets[i] = local_sockets[--num_local_sockets];
continue;
} }
} }
i++;
} }
#endif #endif
......
Markdown is supported
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