diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2017-07-04 18:52:35 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-07-04 19:12:34 +0200 |
commit | 2478df4149e2fb8cd465ef66475d8f1e417f271c (patch) | |
tree | 19bd16c11c8bc05b5d7eb9af8ff8f0bd49e3be00 | |
parent | b3e7f095ce2b91255dd641e68009afba7582db53 (diff) |
Fix: Re-set file length before writing to it
-rw-r--r-- | libimagstore/src/file_abstraction/fs.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libimagstore/src/file_abstraction/fs.rs b/libimagstore/src/file_abstraction/fs.rs index ba15be5e..9fd14456 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) => |