Merge pull request #279 from matthiasbeyer/libimagstore/rewrite-file
Truncate file to zero size before writing new content, so we do not p…
This commit is contained in:
commit
7c276d541d
1 changed files with 2 additions and 0 deletions
|
@ -95,6 +95,8 @@ impl StoreEntry {
|
||||||
let file = try!(self.file.create_file());
|
let file = try!(self.file.create_file());
|
||||||
|
|
||||||
assert_eq!(self.id, entry.location);
|
assert_eq!(self.id, entry.location);
|
||||||
|
try!(file.set_len(0)
|
||||||
|
.map_err(|e| StoreError::new(StoreErrorKind::FileError, Some(Box::new(e)))));
|
||||||
file.write_all(entry.to_str().as_bytes())
|
file.write_all(entry.to_str().as_bytes())
|
||||||
.map_err(|e| StoreError::new(StoreErrorKind::FileError, Some(Box::new(e))))
|
.map_err(|e| StoreError::new(StoreErrorKind::FileError, Some(Box::new(e))))
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue