vm/filecopy: support nonblocking fd in read_all
This will be needed to (non blocking) check if data is available on pipe - especially to receive possible error from the other end (which will be introduced sometime later).
This commit is contained in:
parent
62f626e68f
commit
87511f3112
@ -75,9 +75,14 @@ int read_all(int fd, void *buf, int size)
|
||||
return 0;
|
||||
}
|
||||
if (ret < 0) {
|
||||
if (errno != EAGAIN)
|
||||
perror_wrapper("read");
|
||||
return 0;
|
||||
}
|
||||
if (got_read == 0) {
|
||||
// force blocking operation on further reads
|
||||
set_block(fd);
|
||||
}
|
||||
got_read += ret;
|
||||
}
|
||||
// fprintf(stderr, "read %d bytes\n", size);
|
||||
|
Loading…
Reference in New Issue
Block a user