diff options
| author | Wei Congrui <crvv.mail@gmail.com> | 2017-09-15 15:36:16 +0800 |
|---|---|---|
| committer | Ian Lance Taylor <iant@golang.org> | 2017-09-25 18:20:32 +0000 |
| commit | 5db7572ddfd431e14febbf5f006e0408c5f1ae1b (patch) | |
| tree | a79e2f8a36e8840d8fdf2c20fb1815b9bd2ded95 /src/path/filepath/path_test.go | |
| parent | b71f39612adb671c176586cd9b0018eb3c716f3c (diff) | |
| download | go-5db7572ddfd431e14febbf5f006e0408c5f1ae1b.tar.xz | |
path/filepath: ensure Walk report unreadable directories once
Before this change, if Walk encounters an unreadable directory,
it will call walkFn with this directory twice. Argument err in
the first call is nil, and the second is the permission error.
This change removes the former call and makes Walk call walkFn
with permission error.
Fixes #21758
Change-Id: I21e57c67f3c5a8370fc80a43db3c8009fbce6439
Reviewed-on: https://go-review.googlesource.com/63994
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/path/filepath/path_test.go')
| -rw-r--r-- | src/path/filepath/path_test.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/path/filepath/path_test.go b/src/path/filepath/path_test.go index e1c801b659..3ebd3fbd2d 100644 --- a/src/path/filepath/path_test.go +++ b/src/path/filepath/path_test.go @@ -389,6 +389,12 @@ func checkMarks(t *testing.T, report bool) { // If clear is true, any incoming error is cleared before return. The errors // are always accumulated, though. func mark(info os.FileInfo, err error, errors *[]error, clear bool) error { + name := info.Name() + walkTree(tree, tree.name, func(path string, n *Node) { + if n.name == name { + n.mark++ + } + }) if err != nil { *errors = append(*errors, err) if clear { @@ -396,12 +402,6 @@ func mark(info os.FileInfo, err error, errors *[]error, clear bool) error { } return err } - name := info.Name() - walkTree(tree, tree.name, func(path string, n *Node) { - if n.name == name { - n.mark++ - } - }) return nil } |
