summaryrefslogtreecommitdiffstats
path: root/test/test_filesystem.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_filesystem.c')
-rw-r--r--test/test_filesystem.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/test_filesystem.c b/test/test_filesystem.c
index 9fd6007..511c66e 100644
--- a/test/test_filesystem.c
+++ b/test/test_filesystem.c
@@ -244,7 +244,8 @@ write_to_path(const char* const path, const char* const contents)
const size_t len = strlen(contents);
fwrite(contents, 1, len, f);
- ret = fflush(f) ? errno : ferror(f) ? EBADF : fclose(f) ? errno : 0;
+ ret = fflush(f) ? errno : ferror(f) ? EBADF : 0;
+ ret = (fclose(f) && !ret) ? errno : ret;
}
return ret;