Skip to content

Commit

Permalink
os: return PathError on RemoveAll with trailing dots
Browse files Browse the repository at this point in the history
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 <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
tklauser committed Nov 20, 2018
1 parent 50c3465 commit 7780709
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/os/removeall_at.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7780709

Please sign in to comment.