diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-01-28 23:15:04 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-01-28 23:15:04 +0900 |
| commit | fc95a91eb617beb9130a6b1c7ed7c14a61189f8e (patch) | |
| tree | 99188d1d7b3348b6802a0e02f33fdc93bb5e914b /src/AbstractDiskWriter.cc | |
| parent | 25243da03917b7e36a96a3d28bf99cb578501602 (diff) | |
mingw: Use SetFileValidData to make --file-allocation=falloc work
Diffstat (limited to 'src/AbstractDiskWriter.cc')
| -rw-r--r-- | src/AbstractDiskWriter.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/AbstractDiskWriter.cc b/src/AbstractDiskWriter.cc index b3b4bd8d..2420b6a8 100644 --- a/src/AbstractDiskWriter.cc +++ b/src/AbstractDiskWriter.cc @@ -494,6 +494,15 @@ void AbstractDiskWriter::allocate(int64_t offset, int64_t length, bool sparse) #ifdef HAVE_SOME_FALLOCATE #ifdef __MINGW32__ truncate(offset + length); + if (!SetFileValidData(fd_, offset + length)) { + auto errNum = fileError(); + A2_LOG_WARN(fmt( + "File allocation (SetFileValidData) failed (cause: %s). File will be " + "allocated by filling zero, which blocks whole aria2 execution. Run " + "aria2 as an administrator or use a different file allocation method " + "(see --file-allocation).", + fileStrerror(errNum).c_str())); + } #elif defined(__APPLE__) && defined(__MACH__) auto toalloc = offset + length - size(); while (toalloc > 0) { |
