diff options
author | Nigel Tao <nigeltao@golang.org> | 2023-01-24 09:49:36 +1100 |
---|---|---|
committer | Nigel Tao <nigeltao@golang.org> | 2023-01-25 07:07:01 +0000 |
commit | a11b8e37652ff60302b4a4a55a8a43db6a066ecf (patch) | |
tree | 0a1f0b4fd5a1ca60449fb2de980318862cd99dac /src/os | |
parent | e216ee7e7416df48dc9550a6f18552a4ada5d419 (diff) | |
download | go-git-a11b8e37652ff60302b4a4a55a8a43db6a066ecf.tar.gz |
os: have RemoveAll loop on EINTR
Fixes #57966
Change-Id: Ia732d499ff9bd6e70030daab8fac42d1e204be37
Reviewed-on: https://go-review.googlesource.com/c/go/+/463076
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Nigel Tao <nigeltao@golang.org>
Reviewed-by: Nigel Tao (INACTIVE; USE @golang.org INSTEAD) <nigeltao@google.com>
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/removeall_at.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/os/removeall_at.go b/src/os/removeall_at.go index 8b46152a9e..306debd972 100644 --- a/src/os/removeall_at.go +++ b/src/os/removeall_at.go @@ -58,7 +58,9 @@ func removeAll(path string) error { func removeAllFrom(parent *File, base string) error { parentFd := int(parent.Fd()) // Simple case: if Unlink (aka remove) works, we're done. - err := unix.Unlinkat(parentFd, base, 0) + err := ignoringEINTR(func() error { + return unix.Unlinkat(parentFd, base, 0) + }) if err == nil || IsNotExist(err) { return nil } @@ -75,7 +77,9 @@ func removeAllFrom(parent *File, base string) error { // Is this a directory we need to recurse into? var statInfo syscall.Stat_t - statErr := unix.Fstatat(parentFd, base, &statInfo, unix.AT_SYMLINK_NOFOLLOW) + statErr := ignoringEINTR(func() error { + return unix.Fstatat(parentFd, base, &statInfo, unix.AT_SYMLINK_NOFOLLOW) + }) if statErr != nil { if IsNotExist(statErr) { return nil @@ -151,7 +155,9 @@ func removeAllFrom(parent *File, base string) error { } // Remove the directory itself. - unlinkError := unix.Unlinkat(parentFd, base, unix.AT_REMOVEDIR) + unlinkError := ignoringEINTR(func() error { + return unix.Unlinkat(parentFd, base, unix.AT_REMOVEDIR) + }) if unlinkError == nil || IsNotExist(unlinkError) { return nil } |