From 03d037c1974d8798e6844bfba48b34443e7edc4e Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Sun, 6 Apr 2014 17:00:42 -0300 Subject: [PATCH] truncate file when saving settings --- src/twister_utils.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/twister_utils.cpp b/src/twister_utils.cpp index 5abe5fc0..5260510b 100644 --- a/src/twister_utils.cpp +++ b/src/twister_utils.cpp @@ -71,6 +71,7 @@ int save_file(std::string const& filename, std::vector& v) libtorrent::error_code ec; if (!f.open(filename, file::write_only, ec)) return -1; if (ec) return -1; + f.set_size(0, ec); file::iovec_t b = {&v[0], v.size()}; size_type written = f.writev(0, &b, 1, ec); if (written != int(v.size())) return -3;