mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-30 02:31:05 +02:00
Fix: Open files read only if requested
This commit is contained in:
@ -3464,7 +3464,7 @@ static FILE* OpenDiskFile(const CDiskBlockPos &pos, const char *prefix, bool fRe
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
fs::path path = GetBlockPosFilename(pos, prefix);
|
fs::path path = GetBlockPosFilename(pos, prefix);
|
||||||
fs::create_directories(path.parent_path());
|
fs::create_directories(path.parent_path());
|
||||||
FILE* file = fsbridge::fopen(path, "rb+");
|
FILE* file = fsbridge::fopen(path, fReadOnly ? "rb": "rb+");
|
||||||
if (!file && !fReadOnly)
|
if (!file && !fReadOnly)
|
||||||
file = fsbridge::fopen(path, "wb+");
|
file = fsbridge::fopen(path, "wb+");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
Reference in New Issue
Block a user