mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 23:29:12 +01:00
util: Introduce DirectoryCommit commit function to sync a directory
This commit is contained in:
committed by
Luke Dashjr
parent
ce5cbaea63
commit
220bb16cbe
@@ -1043,6 +1043,15 @@ bool FileCommit(FILE *file)
|
||||
return true;
|
||||
}
|
||||
|
||||
void DirectoryCommit(const fs::path &dirname)
|
||||
{
|
||||
#ifndef WIN32
|
||||
FILE* file = fsbridge::fopen(dirname, "r");
|
||||
fsync(fileno(file));
|
||||
fclose(file);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool TruncateFile(FILE *file, unsigned int length) {
|
||||
#if defined(WIN32)
|
||||
return _chsize(_fileno(file), length) == 0;
|
||||
|
||||
Reference in New Issue
Block a user