Merge branch 'session-fix' of github.com:stickz/rtorrent-rak into stickz-session-fix

This commit is contained in:
rakshasa
2024-09-07 08:17:07 +00:00
+10
View File
@@ -40,6 +40,7 @@
#include <fstream>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <rak/error_number.h>
#include <rak/path.h>
@@ -121,6 +122,15 @@ DownloadStore::write_bencode(const std::string& filename, const torrent::Object&
goto download_store_save_error;
output.close();
// Ensure that the new file is actually written to the disk
int fd = ::open(filename.c_str(), O_WRONLY);
if (fd < 0)
goto download_store_save_error;
fdatasync(fd);
::close(fd);
return true;
download_store_save_error: