mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-05 18:52:29 +02:00
util: use stronger-guarantee rename method
Use std::filesystem::rename() instead of std::rename(). We rely on the destination to be overwritten if it exists, but std::rename()'s behavior is implementation-defined in this case.
This commit is contained in:
@@ -69,7 +69,13 @@ void DirectoryCommit(const fs::path &dirname);
|
||||
bool TruncateFile(FILE *file, unsigned int length);
|
||||
int RaiseFileDescriptorLimit(int nMinFD);
|
||||
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length);
|
||||
|
||||
/**
|
||||
* Rename src to dest.
|
||||
* @return true if the rename was successful.
|
||||
*/
|
||||
[[nodiscard]] bool RenameOver(fs::path src, fs::path dest);
|
||||
|
||||
bool LockDirectory(const fs::path& directory, const std::string lockfile_name, bool probe_only=false);
|
||||
void UnlockDirectory(const fs::path& directory, const std::string& lockfile_name);
|
||||
bool DirIsWritable(const fs::path& directory);
|
||||
|
||||
Reference in New Issue
Block a user