File: fix write_buffer_to_file

This commit is contained in:
Maxime Coste 2011-10-03 18:40:12 +00:00
parent 6a0b570e50
commit 945426f47a

View File

@ -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));