mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-20 08:06:18 +00:00
Merge branch 'stickz-session-fix'
This commit is contained in:
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <rak/error_number.h>
|
#include <rak/error_number.h>
|
||||||
#include <rak/path.h>
|
#include <rak/path.h>
|
||||||
@@ -100,6 +101,7 @@ DownloadStore::set_path(const std::string& path) {
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
DownloadStore::write_bencode(const std::string& filename, const torrent::Object& obj, uint32_t skip_mask) {
|
DownloadStore::write_bencode(const std::string& filename, const torrent::Object& obj, uint32_t skip_mask) {
|
||||||
|
int fd;
|
||||||
torrent::Object tmp;
|
torrent::Object tmp;
|
||||||
std::fstream output(filename.c_str(), std::ios::out | std::ios::trunc);
|
std::fstream output(filename.c_str(), std::ios::out | std::ios::trunc);
|
||||||
|
|
||||||
@@ -121,6 +123,15 @@ DownloadStore::write_bencode(const std::string& filename, const torrent::Object&
|
|||||||
goto download_store_save_error;
|
goto download_store_save_error;
|
||||||
|
|
||||||
output.close();
|
output.close();
|
||||||
|
|
||||||
|
// Ensure that the new file is actually written to the disk
|
||||||
|
fd = ::open(filename.c_str(), O_WRONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
goto download_store_save_error;
|
||||||
|
|
||||||
|
fdatasync(fd);
|
||||||
|
::close(fd);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
download_store_save_error:
|
download_store_save_error:
|
||||||
|
|||||||
Reference in New Issue
Block a user