diff options
author | Luke Dashjr <luke-jr+git@utopios.org> | 2018-10-17 08:34:53 +0000 |
---|---|---|
committer | Luke Dashjr <luke-jr+git@utopios.org> | 2020-08-25 16:46:46 +0000 |
commit | ef712298c3f8bc2afdad783f05080443b72b3f77 (patch) | |
tree | 2b180f7dd2479894d3f8e7e8898d7f4e9129f711 | |
parent | 457490403853321d308c6ca6aaa90d6f8f29b4cf (diff) | |
download | bitcoin-ef712298c3f8bc2afdad783f05080443b72b3f77.tar.xz |
util: Check for file being NULL in DirectoryCommit
-rw-r--r-- | src/util/system.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp index 43c6ae54ab..2ed9cf7048 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -1047,8 +1047,10 @@ void DirectoryCommit(const fs::path &dirname) { #ifndef WIN32 FILE* file = fsbridge::fopen(dirname, "r"); - fsync(fileno(file)); - fclose(file); + if (file) { + fsync(fileno(file)); + fclose(file); + } #endif } |