Fix: Re-set file length before writing to it
This commit is contained in:
parent
b3e7f095ce
commit
2478df4149
1 changed files with 3 additions and 0 deletions
|
@ -84,6 +84,9 @@ impl FileAbstractionInstance for FSFileAbstractionInstance {
|
||||||
// access to the file to be in a different context
|
// access to the file to be in a different context
|
||||||
try!(f.seek(SeekFrom::Start(0))
|
try!(f.seek(SeekFrom::Start(0))
|
||||||
.map_err_into(SEK::FileNotCreated));
|
.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)
|
f.write_all(&buf).map_err_into(SEK::FileNotWritten)
|
||||||
},
|
},
|
||||||
FSFileAbstractionInstance::Absent(ref p) =>
|
FSFileAbstractionInstance::Absent(ref p) =>
|
||||||
|
|
Loading…
Reference in a new issue