]> Cypherpunks repositories - gostls13.git/commitdiff
os: don't return ENOENT if directory removed before Fstatat
authorIan Lance Taylor <iant@golang.org>
Tue, 12 Feb 2019 18:20:28 +0000 (10:20 -0800)
committerIan Lance Taylor <iant@golang.org>
Tue, 12 Feb 2019 21:17:38 +0000 (21:17 +0000)
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>
src/os/removeall_at.go

index 7f2d5922ae03c3f5ab387c4af2dbb39986f047ff..0b7d5efb7a5bbf51197c3b0bee25acf5972384f6 100644 (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 {