mirror of
https://github.com/octoleo/restic.git
synced 2024-11-16 18:15:20 +00:00
Merge pull request #876 from middelink/fix-836
Restore does not truncate files it restores
This commit is contained in:
commit
8d0140aabe
@ -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 New Issue
Block a user