mirror of
https://github.com/octoleo/restic.git
synced 2024-12-23 11:28:54 +00:00
Restore does not truncate files it restores
Missing O_TRUNC when doing O_CREAT. Closes #875
This commit is contained in:
parent
8958efba60
commit
b75186533d
@ -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