Skip to content

Commit

Permalink
f3write: fix saved_error bug
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AltraMayor committed Dec 19, 2017
1 parent 485b81c commit 865c44f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion f3write.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 865c44f

Please sign in to comment.