aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/io/FileOutputStream.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-03-24 21:51:34 +0100
committerMax Kellermann <max@duempel.org>2015-03-24 21:59:34 +0100
commit6387b528961010b09e20fe807b5207ca7bf821f9 (patch)
tree4164551a066a671e1db63914aa330928a51c8a07 /src/fs/io/FileOutputStream.cxx
parent077e95da852189601fcc156fda9ec8f4a64887cb (diff)
downloadmpd-6387b528961010b09e20fe807b5207ca7bf821f9.tar.gz
mpd-6387b528961010b09e20fe807b5207ca7bf821f9.tar.xz
mpd-6387b528961010b09e20fe807b5207ca7bf821f9.zip
fs/io/FileOutputStream: seek end-of-file in AppendFileOutputStream ctor
Diffstat (limited to 'src/fs/io/FileOutputStream.cxx')
-rw-r--r--src/fs/io/FileOutputStream.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx
index 82d9c3dc1..c7410f180 100644
--- a/src/fs/io/FileOutputStream.cxx
+++ b/src/fs/io/FileOutputStream.cxx
@@ -226,6 +226,12 @@ AppendFileOutputStream::AppendFileOutputStream(Path _path, Error &error)
if (!IsDefined())
error.FormatLastError("Failed to append to %s",
GetPath().ToUTF8().c_str());
+
+ if (!SeekEOF()) {
+ error.FormatLastError("Failed seek end-of-file of %s",
+ GetPath().ToUTF8().c_str());
+ Close();
+ }
#else
if (!SetFD().Open(GetPath().c_str(),
O_WRONLY|O_APPEND))