Skip to content

Commit 504f1e8

Browse files
authored
Make open function calls in coreclr EINTR resilient on macOS (#56403)
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.
1 parent 6d97b44 commit 504f1e8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/coreclr/pal/src/cruntime/filecrt.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,16 @@ CorUnix::InternalOpen(
229229
va_end(ap);
230230
}
231231

232+
do
233+
{
232234
#if OPEN64_IS_USED_INSTEAD_OF_OPEN
233235
nRet = open64(szPath, nFlags, mode);
234236
#else
235237
nRet = open(szPath, nFlags, mode);
236238
#endif
239+
}
240+
while ((nRet == -1) && (errno == EINTR));
241+
237242
return nRet;
238243
}
239244

0 commit comments

Comments
 (0)