summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-07-04 19:31:37 +0200
committerGitHub <noreply@github.com>2017-07-04 19:31:37 +0200
commite80608c6097cac5a44d16a0d28ae7c1279c8a6a5 (patch)
treec210c4cd1c7c3ab486814732692aade6dc450028
parentc75cfe4b608068fd65b4a2fa273a7b06f7ed51b6 (diff)
parent2478df4149e2fb8cd465ef66475d8f1e417f271c (diff)
downloadimag-e80608c6097cac5a44d16a0d28ae7c1279c8a6a5.zip
imag-e80608c6097cac5a44d16a0d28ae7c1279c8a6a5.tar.gz
Merge pull request #989 from matthiasbeyer/libimagstore/fix-file-length-setting
Fix: Re-set file length before writing to it
-rw-r--r--libimagstore/src/file_abstraction/fs.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/libimagstore/src/file_abstraction/fs.rs b/libimagstore/src/file_abstraction/fs.rs
index ba15be5..9fd1445 100644
--- a/libimagstore/src/file_abstraction/fs.rs
+++ b/libimagstore/src/file_abstraction/fs.rs
@@ -84,6 +84,9 @@ impl FileAbstractionInstance for FSFileAbstractionInstance {
// access to the file to be in a different context
try!(f.seek(SeekFrom::Start(0))
.map_err_into(SEK::FileNotCreated));
+
+ try!(f.set_len(buf.len() as u64).map_err_into(SEK::FileNotWritten));
+
f.write_all(&buf).map_err_into(SEK::FileNotWritten)
},
FSFileAbstractionInstance::Absent(ref p) =>