2
2
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:
Alexander Neumann 2017-03-11 10:12:53 +01:00
commit 8d0140aabe
3 changed files with 3 additions and 3 deletions

View File

@ -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 {

View File

@ -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

View File

@ -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 {