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:
Ian Lance Taylor 2019-02-12 10:20:28 -08:00
parent 11af353531
commit cf4dc25503

View file

@ -71,6 +71,9 @@ func removeAllFrom(parent *File, path string) error {
var statInfo syscall.Stat_t
statErr := unix.Fstatat(parentFd, path, &statInfo, unix.AT_SYMLINK_NOFOLLOW)
if statErr != nil {
if IsNotExist(statErr) {
return nil
}
return statErr
}
if statInfo.Mode&syscall.S_IFMT != syscall.S_IFDIR {