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:
Michel Machado 2017-12-19 15:22:48 -05:00
parent 485b81ceb0
commit 865c44f21c

View File

@ -540,7 +540,9 @@ static int create_and_fill_file(const char *path, long number, size_t size,
close(fd);
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");
return saved_errno == ENOSPC;
}