Skip to content

Commit

Permalink
Make open function calls in coreclr EINTR resilient on macOS (#56403)
Browse files Browse the repository at this point in the history
It was reported that on macOS, the open syscall can sometimes
return EINTR if it is interrupted by a signal even if the
signal has a handler installed with SA_RESTART.

There was just one call to open in the coreclr that
didn't have EINTR handled and that can be called on macOS, so
this change fixes it.

There are two places in the libraries in the included 3rd party
code - the brotli and the zlib - that don't have this treatment yet.
We may want to update them unless the policy we have for them is
to make changes upstream.
  • Loading branch information
janvorli committed Jul 28, 2021
1 parent 6d97b44 commit 504f1e8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/coreclr/pal/src/cruntime/filecrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,16 @@ CorUnix::InternalOpen(
va_end(ap);
}

do
{
#if OPEN64_IS_USED_INSTEAD_OF_OPEN
nRet = open64(szPath, nFlags, mode);
#else
nRet = open(szPath, nFlags, mode);
#endif
}
while ((nRet == -1) && (errno == EINTR));

return nRet;
}

Expand Down

0 comments on commit 504f1e8

Please sign in to comment.