mirror of
https://github.com/AltraMayor/f3.git
synced 2025-09-15 10:07:26 -04:00
f3probe: report unexpected error codes in read_all()
No unexpected error code should happen in read_all(), but, if it does, f3probe will report them before aborting. This patch address the request of user @vi at the following comment: https://github.com/AltraMayor/f3/issues/82#issuecomment-585829975
This commit is contained in:
parent
3c19d21859
commit
5846f9dbb1
11
libdevs.c
11
libdevs.c
@ -415,7 +415,16 @@ static int read_all(int fd, char *buf, size_t count)
|
||||
if (rc < 0) {
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
assert(errno == EIO || errno == ENODATA);
|
||||
if (errno == EIO || errno == ENODATA) {
|
||||
/* These errors are "expected",
|
||||
* so ignore them.
|
||||
*/
|
||||
} else {
|
||||
/* Execution should not come here. */
|
||||
err(errno,
|
||||
"%s(): unexpected error code from read(2) = %i",
|
||||
__func__, errno);
|
||||
}
|
||||
return - errno;
|
||||
}
|
||||
assert(rc != 0); /* We should never hit the end of the file. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user