Skip to content

Commit 24c5d09

Browse files
kulikjakadorilson
authored andcommitted
bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)
I just realized that my recent PR with sendfile on Solaris ([PR 22040](python/cpython#22040)) has broken error handling. Sorry for that, this simple followup fixes that. Automerge-Triggered-By: @1st1
1 parent 2d1ecd6 commit 24c5d09

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Modules/posixmodule.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -9521,14 +9521,13 @@ os_sendfile_impl(PyObject *module, int out_fd, int in_fd, PyObject *offobj,
95219521
#if defined(__sun) && defined(__SVR4)
95229522
// On Solaris, sendfile raises EINVAL rather than returning 0
95239523
// when the offset is equal or bigger than the in_fd size.
9524-
int res;
95259524
struct stat st;
95269525

95279526
do {
95289527
Py_BEGIN_ALLOW_THREADS
9529-
res = fstat(in_fd, &st);
9528+
ret = fstat(in_fd, &st);
95309529
Py_END_ALLOW_THREADS
9531-
} while (res != 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
9530+
} while (ret != 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));
95329531
if (ret < 0)
95339532
return (!async_err) ? posix_error() : NULL;
95349533

0 commit comments

Comments
 (0)