local: Fix fd leak when encountering files directly inside data/

This commit is contained in:
Michael Eischer 2021-11-06 19:44:57 +01:00
parent 6c84ea1412
commit 15d7313387

View file

@ -322,6 +322,8 @@ func visitFiles(ctx context.Context, dir string, fn func(restic.FileInfo) error,
if ignoreNotADirectory {
fi, err := d.Stat()
if err != nil || !fi.IsDir() {
// ignore subsequent errors
_ = d.Close()
return err
}
}