From: Tobias Klauser Date: Sun, 18 Nov 2018 16:18:37 +0000 (+0100) Subject: os: return PathError on RemoveAll with trailing dots X-Git-Tag: go1.12beta1~297 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=77807093692070801b66960b6918fb59c9b470cd;p=gostls13.git 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 TryBot-Result: Gobot Gobot Reviewed-by: Ian Lance Taylor --- diff --git a/src/os/removeall_at.go b/src/os/removeall_at.go index 5eea770a3e..777690ec66 100644 --- a/src/os/removeall_at.go +++ b/src/os/removeall_at.go @@ -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