Commit 874b1604 authored by Dominik Haumann's avatar Dominik Haumann
Browse files

backport: truncate files when opening for writing

This backport was kind of requested in bug #323693.

FIXED-IN: 4.12.4
CCBUG: 323693
parent e6674b9f
......@@ -732,8 +732,9 @@ bool TextBuffer::save (const QString &filename)
/**
* try to open or fail
*/
if (!saveFile.open())
if (!saveFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
return false;
}
/**
* construct correct filter device and try to open
......@@ -747,7 +748,7 @@ bool TextBuffer::save (const QString &filename)
* try to open, if new file
*/
if (deleteFile) {
if (!file->open (QIODevice::WriteOnly)) {
if (!file->open (QIODevice::WriteOnly | QIODevice::Truncate)) {
delete file;
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment