mirror of
https://github.com/AltraMayor/f3.git
synced 2025-09-10 07:39:31 -04:00
f3write: fix saved_error bug
When measure() fails at the very last end of a file, @remaining is zero. Since @saved_errno is not ENOSPC, but @remaining is zero, the code was considering that the file was properly written.
This commit is contained in:
parent
485b81ceb0
commit
865c44f21c
@ -540,7 +540,9 @@ static int create_and_fill_file(const char *path, long number, size_t size,
|
|||||||
close(fd);
|
close(fd);
|
||||||
free(full_fn);
|
free(full_fn);
|
||||||
|
|
||||||
if (saved_errno == ENOSPC || remaining == 0) {
|
if (saved_errno == 0 || saved_errno == ENOSPC) {
|
||||||
|
if (saved_errno == 0)
|
||||||
|
assert(remaining == 0);
|
||||||
printf("OK!\n");
|
printf("OK!\n");
|
||||||
return saved_errno == ENOSPC;
|
return saved_errno == ENOSPC;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user