From 945426f47a6da2b1aabd823e83da4499f1f9e8c5 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 3 Oct 2011 18:40:12 +0000 Subject: [PATCH] File: fix write_buffer_to_file --- src/file.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/file.cc b/src/file.cc index 8636422c..af9caad9 100644 --- a/src/file.cc +++ b/src/file.cc @@ -44,7 +44,7 @@ Buffer* create_buffer_from_file(const std::string& filename) void write_buffer_to_file(const Buffer& buffer, const std::string& filename) { - int fd = open(filename.c_str(), O_CREAT | O_WRONLY, 0644); + int fd = open(filename.c_str(), O_CREAT | O_WRONLY | O_TRUNC, 0644); if (fd == -1) throw file_access_error(filename, strerror(errno));