1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-03-09 00:00:02 +01:00

SkipDirs with errors

This commit is contained in:
Jan Bader 2015-11-05 23:15:38 +01:00
parent ff473dbab6
commit 2189d8fbce

View file

@ -685,7 +685,7 @@ func Scan(dirs []string, filter pipe.SelectFunc, p *Progress) (Stat, error) {
// TODO: integrate error reporting
if err != nil {
fmt.Fprintf(os.Stderr, "error for %v: %v\n", str, err)
return nil
return filepath.SkipDir
}
if fi == nil {
fmt.Fprintf(os.Stderr, "error for %v: FileInfo is nil\n", str)
@ -702,6 +702,13 @@ func Scan(dirs []string, filter pipe.SelectFunc, p *Progress) (Stat, error) {
s := Stat{}
if fi.IsDir() {
_, err2 := os.Stat(str)
if err2 != nil {
debug.Log("Scan.Walk", "%v, err: %v", str, err2)
fmt.Fprintf(os.Stderr, "error for %v: %v\n", str, err2)
return filepath.SkipDir
}
s.Dirs++
} else {
s.Files++