]> Cypherpunks repositories - gostls13.git/commit
os: RemoveAll: fix error returned
authorKir Kolyshkin <kolyshkin@gmail.com>
Thu, 30 May 2024 21:00:40 +0000 (14:00 -0700)
committerGopher Robot <gobot@golang.org>
Tue, 11 Jun 2024 17:09:26 +0000 (17:09 +0000)
commit3b6aa03c127ac9600ed17bd27ae94088b741846e
tree8fc00e1bac00dea90ae6b3803af03be9c6e6c03c
parentaed1f925f24d4ad6ff2f2d77c04e4c5b72fdb49f
os: RemoveAll: fix error returned

When unlink fails, it is not yet known if the argument is a directory or not.
Since CL 588495, we figure out if it's a directory when trying to open
it (and, for a directory, return the original unlink error).

The (very minor) issue is, in case of a symlink, a different error is
returned -- usually it's ELOOP, but some systems use other values. Let's
account for that error code, too.

This is a followup to CL 588495.

Change-Id: I4ee10fe9b57f045fbca02f13e5c9ea16972803bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/589376
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Kirill Kolyshkin <kolyshkin@gmail.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
src/internal/syscall/unix/constants.go
src/internal/syscall/unix/nofollow_bsd.go [new file with mode: 0644]
src/internal/syscall/unix/nofollow_netbsd.go [new file with mode: 0644]
src/internal/syscall/unix/nofollow_posix.go [new file with mode: 0644]
src/os/removeall_at.go