From e4986c489ebdc52bd6aef2638cf923c8bc73eb35 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 26 Jul 2023 02:07:55 +0530 Subject: [PATCH] Ignore EINTR --- kittens/transfer/receive.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kittens/transfer/receive.go b/kittens/transfer/receive.go index a9877765d..e31d5969b 100644 --- a/kittens/transfer/receive.go +++ b/kittens/transfer/receive.go @@ -250,9 +250,17 @@ func syscall_mode(i os.FileMode) (o uint32) { func (self *remote_file) apply_metadata() { t := unix.NsecToTimespec(int64(self.mtime)) - unix.UtimesNanoAt(unix.AT_FDCWD, self.expanded_local_path, []unix.Timespec{t, t}, unix.AT_SYMLINK_NOFOLLOW) + for { + if err := unix.UtimesNanoAt(unix.AT_FDCWD, self.expanded_local_path, []unix.Timespec{t, t}, unix.AT_SYMLINK_NOFOLLOW); err == nil || !(errors.Is(err, unix.EINTR) || errors.Is(err, unix.EAGAIN)) { + break + } + } if self.ftype == FileType_symlink { - unix.Fchmodat(unix.AT_FDCWD, self.expanded_local_path, syscall_mode(self.permissions), unix.AT_SYMLINK_NOFOLLOW) + for { + if err := unix.Fchmodat(unix.AT_FDCWD, self.expanded_local_path, syscall_mode(self.permissions), unix.AT_SYMLINK_NOFOLLOW); err == nil || !(errors.Is(err, unix.EINTR) || errors.Is(err, unix.EAGAIN)) { + break + } + } } else { os.Chmod(self.expanded_local_path, self.permissions) }