Skip to content

Commit 0be55f8

Browse files
committed
windows: create files if they don't exist, and with write permission
1 parent 2cb0ddf commit 0be55f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libutil/fs-sink.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void RestoreSink::createRegularFile(const CanonPath & path, std::function<void(C
112112
crf.startFsync = startFsync;
113113
crf.fd =
114114
#ifdef _WIN32
115-
CreateFileW(p.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)
115+
CreateFileW(p.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL)
116116
#else
117117
open(p.c_str(), O_CREAT | O_EXCL | O_WRONLY | O_CLOEXEC, 0666)
118118
#endif

0 commit comments

Comments
 (0)