diff options
author | David Robillard <d@drobilla.net> | 2024-11-15 14:28:23 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2024-11-15 14:28:23 -0500 |
commit | 9b604f9ce034ca487bb49272e119fc79edf479c8 (patch) | |
tree | 5c2ba86cf2c10c4390d382ade43aecbf24d9d315 | |
parent | e58b18dbcea3646ac9ec8b0d96f54c1111819d59 (diff) | |
download | zix-9b604f9ce034ca487bb49272e119fc79edf479c8.tar.gz zix-9b604f9ce034ca487bb49272e119fc79edf479c8.tar.bz2 zix-9b604f9ce034ca487bb49272e119fc79edf479c8.zip |
Avoid potential open file leak in test
-rw-r--r-- | test/test_filesystem.c | 3 |
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; |