diff --git a/src/file_win.cpp b/src/file_win.cpp index 542ba88ce..7189e09e5 100644 --- a/src/file_win.cpp +++ b/src/file_win.cpp @@ -171,11 +171,12 @@ namespace libtorrent if (new_handle == INVALID_HANDLE_VALUE) throw_exception(file_name); // try to make the file sparse if supported - DWORD temp; - int ret = ::DeviceIoControl(new_handle, FSCTL_SET_SPARSE, 0, 0 - , 0, 0, &temp, 0); - if (ret == 0) - throw_exception(file_name); + if (access_mask & GENERIC_WRITE) + { + DWORD temp; + ::DeviceIoControl(new_handle, FSCTL_SET_SPARSE, 0, 0 + , 0, 0, &temp, 0); + } // will only close old file if the open succeeded close(); m_file_handle = new_handle; diff --git a/src/storage.cpp b/src/storage.cpp index d394165f8..66e761655 100755 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -2043,7 +2043,6 @@ namespace libtorrent assert(m_piece_to_slot[pos] >= 0); m_storage->read(&buffer[0], m_piece_to_slot[pos], 0 , static_cast(m_info.piece_size(pos))); - std::cerr << "reading" << std::endl; new_free_slot = m_piece_to_slot[pos]; m_slot_to_piece[pos] = pos; m_piece_to_slot[pos] = pos; @@ -2055,7 +2054,6 @@ namespace libtorrent if (write_back || m_fill_mode) { - std::cerr << "writing" << std::endl; m_storage->write(&buffer[0], pos, 0, static_cast(m_info.piece_size(pos))); written = true; if (abort_on_disk) return true;