mirror of https://github.com/python/cpython
bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)
I just realized that my recent PR with sendfile on Solaris ([PR 22040](https://github.com/python/cpython/pull/22040)) has broken error handling. Sorry for that, this simple followup fixes that. Automerge-Triggered-By: @1st1
This commit is contained in:
parent
76553e5d2e
commit
fa8c9e7010
|
@ -9521,14 +9521,13 @@ done:
|
||||||
#if defined(__sun) && defined(__SVR4)
|
#if defined(__sun) && defined(__SVR4)
|
||||||
// On Solaris, sendfile raises EINVAL rather than returning 0
|
// On Solaris, sendfile raises EINVAL rather than returning 0
|
||||||
// when the offset is equal or bigger than the in_fd size.
|
// when the offset is equal or bigger than the in_fd size.
|
||||||
int res;
|
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS
|
||||||
res = fstat(in_fd, &st);
|
ret = fstat(in_fd, &st);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
} while (res != 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
|
} while (ret != 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return (!async_err) ? posix_error() : NULL;
|
return (!async_err) ? posix_error() : NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue