Commit 77807093 authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

os: return PathError on RemoveAll with trailing dots

Return a PathError instead of an unwrapped syscall.EINVAL if the path
ends with dots.

As suggested by Roger Peppe in CL 150158.

Change-Id: I4d82a6ff64a979b67a843a1cc4fea58ed9326aed
Reviewed-on: https://go-review.googlesource.com/c/150160
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 50c3465f
......@@ -22,7 +22,7 @@ func RemoveAll(path string) error {
// The rmdir system call does not permit removing ".",
// so we don't permit it either.
if endsWithDot(path) {
return syscall.EINVAL
return &PathError{"RemoveAll", path, syscall.EINVAL}
}
// RemoveAll recurses by deleting the path base from
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment