mirror of
https://github.com/AltraMayor/f3.git
synced 2025-09-09 15:22:40 -04:00
f3probe: improve I/O error handling
This commit is contained in:
parent
7c0306ca6f
commit
b70b9ce914
@ -320,7 +320,10 @@ static int read_all(int fd, char *buf, int count)
|
|||||||
int done = 0;
|
int done = 0;
|
||||||
do {
|
do {
|
||||||
ssize_t rc = read(fd, buf + done, count - done);
|
ssize_t rc = read(fd, buf + done, count - done);
|
||||||
assert(rc >= 0); /* Did the read() went right? */
|
if (rc < 0) {
|
||||||
|
assert(errno == EIO);
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
assert(rc != 0); /* We should never hit the end of the file. */
|
assert(rc != 0); /* We should never hit the end of the file. */
|
||||||
done += rc;
|
done += rc;
|
||||||
} while (done < count);
|
} while (done < count);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user