2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-24 21:57:41 +00:00

backup: Improve error handling

This commit is contained in:
Alexander Neumann 2021-01-30 16:49:15 +01:00
parent 1a0eb05bfa
commit cbd88c457a

View File

@ -205,10 +205,21 @@ func readFilenamesFromFileRaw(filename string) (names []string, err error) {
if f, err = os.Open(filename); err != nil { if f, err = os.Open(filename); err != nil {
return nil, err return nil, err
} }
defer f.Close()
} }
return readFilenamesRaw(f) names, err = readFilenamesRaw(f)
if err != nil {
// ignore subsequent errors
_ = f.Close()
return nil, err
}
err = f.Close()
if err != nil {
return nil, err
}
return names, nil
} }
func readFilenamesRaw(r io.Reader) (names []string, err error) { func readFilenamesRaw(r io.Reader) (names []string, err error) {