fix: Truncate file if -o is specified before writing for tar backend

This commit is contained in:
Felicitas Pojtinger
2021-11-20 17:00:25 +01:00
parent 93adb5da13
commit 988b6f5060

View File

@@ -49,6 +49,10 @@ var archiveCmd = &cobra.Command{
if err != nil {
return err
}
if err := f.Truncate(0); err != nil {
return err
}
} else {
f, err = os.OpenFile(viper.GetString(tapeFlag), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if err != nil {