From 77807093692070801b66960b6918fb59c9b470cd Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Sun, 18 Nov 2018 17:18:37 +0100 Subject: [PATCH] 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 --- src/os/removeall_at.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- 2.48.1