Skip to content

Commit 6a39888

Browse files
bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)
I just realized that my recent PR with sendfile on Solaris ([PR 22040](#22040)) has broken error handling. Sorry for that, this simple followup fixes that. Automerge-Triggered-By: @1st1 (cherry picked from commit fa8c9e7) Co-authored-by: Jakub Kulík <[email protected]>
1 parent 7e356f1 commit 6a39888

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Modules/posixmodule.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9456,14 +9456,13 @@ os_sendfile_impl(PyObject *module, int out_fd, int in_fd, PyObject *offobj,
94569456
#if defined(__sun) && defined(__SVR4)
94579457
// On Solaris, sendfile raises EINVAL rather than returning 0
94589458
// when the offset is equal or bigger than the in_fd size.
9459-
int res;
94609459
struct stat st;
94619460

94629461
do {
94639462
Py_BEGIN_ALLOW_THREADS
9464-
res = fstat(in_fd, &st);
9463+
ret = fstat(in_fd, &st);
94659464
Py_END_ALLOW_THREADS
9466-
} while (res != 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
9465+
} while (ret != 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
94679466
if (ret < 0)
94689467
return (!async_err) ? posix_error() : NULL;
94699468

0 commit comments

Comments
 (0)