lib/scanner: Error handling in walk function (fixes #4753) (#4754)

This commit is contained in:
Jakob Borg 2018-02-13 11:02:07 +01:00 committed by Audrius Butkevicius
parent 2bbd2d6ed1
commit c120c3a403

View File

@ -255,11 +255,14 @@ func (w *walker) createFSWalkFn(ctx context.Context, fsChan chan<- fsWalkResult)
skip = fs.SkipDir
}
if path == "." {
if err != nil {
fsWalkError(ctx, fsChan, path, err)
return skip
if err != nil {
if sendErr := fsWalkError(ctx, fsChan, path, err); sendErr != nil {
return sendErr
}
return skip
}
if path == "." {
return nil
}
@ -282,13 +285,6 @@ func (w *walker) createFSWalkFn(ctx context.Context, fsChan chan<- fsWalkResult)
return skip
}
if err != nil {
if sendErr := fsWalkError(ctx, fsChan, path, err); sendErr != nil {
return sendErr
}
return skip
}
if !utf8.ValidString(path) {
if err := fsWalkError(ctx, fsChan, path, errors.New("path isn't a valid utf8 string")); err != nil {
return err