forked from TrueCloudLab/restic
Merge pull request #876 from middelink/fix-836
Restore does not truncate files it restores
This commit is contained in:
commit
8d0140aabe
3 changed files with 3 additions and 3 deletions
|
@ -53,7 +53,7 @@ func initDebugLogger() {
|
|||
}
|
||||
|
||||
if err != nil && os.IsNotExist(errors.Cause(err)) {
|
||||
f, err = fs.OpenFile(debugfile, os.O_WRONLY|os.O_CREATE, 0600)
|
||||
f, err = fs.OpenFile(debugfile, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
|
|
@ -44,7 +44,7 @@ func loadIDSet(t testing.TB, filename string) restic.BlobSet {
|
|||
}
|
||||
|
||||
func saveIDSet(t testing.TB, filename string, s restic.BlobSet) {
|
||||
f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, 0644)
|
||||
f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
t.Fatalf("unable to update golden file %v: %v", filename, err)
|
||||
return
|
||||
|
|
|
@ -234,7 +234,7 @@ func (node Node) createFileAt(path string, repo Repository, idx *HardlinkIndex)
|
|||
return nil
|
||||
}
|
||||
|
||||
f, err := fs.OpenFile(path, os.O_CREATE|os.O_WRONLY, 0600)
|
||||
f, err := fs.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0600)
|
||||
defer f.Close()
|
||||
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue