mirror of https://github.com/golang/go.git
os: don't return ENOENT if directory removed before Fstatat
Fixes #30197 Change-Id: I08b592fbd477d6879eb5d3b7fcbbc8322ea90103 Reviewed-on: https://go-review.googlesource.com/c/162078 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
11af353531
commit
cf4dc25503
|
|
@ -71,6 +71,9 @@ func removeAllFrom(parent *File, path string) error {
|
||||||
var statInfo syscall.Stat_t
|
var statInfo syscall.Stat_t
|
||||||
statErr := unix.Fstatat(parentFd, path, &statInfo, unix.AT_SYMLINK_NOFOLLOW)
|
statErr := unix.Fstatat(parentFd, path, &statInfo, unix.AT_SYMLINK_NOFOLLOW)
|
||||||
if statErr != nil {
|
if statErr != nil {
|
||||||
|
if IsNotExist(statErr) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return statErr
|
return statErr
|
||||||
}
|
}
|
||||||
if statInfo.Mode&syscall.S_IFMT != syscall.S_IFDIR {
|
if statInfo.Mode&syscall.S_IFMT != syscall.S_IFDIR {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue