mirror of
https://github.com/rustic-rs/rustic.git
synced 2025-10-26 11:18:51 +00:00
Merge pull request #115 from rustic-rs/local-be-truncate
local backend: truncate file to correct length (if it exists)
This commit is contained in:
commit
effd7240bd
@ -144,6 +144,7 @@ impl WriteBackend for LocalBackend {
|
||||
.create(true)
|
||||
.write(true)
|
||||
.open(&filename)?;
|
||||
file.set_len(0)?;
|
||||
copy(&mut f, &mut file)?;
|
||||
file.sync_all()?;
|
||||
Ok(())
|
||||
@ -156,6 +157,7 @@ impl WriteBackend for LocalBackend {
|
||||
.create(true)
|
||||
.write(true)
|
||||
.open(&filename)?;
|
||||
file.set_len(buf.len().try_into()?)?;
|
||||
file.write_all(&buf)?;
|
||||
file.sync_all()?;
|
||||
Ok(())
|
||||
|
||||
Loading…
Reference in New Issue
Block a user