From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 16 Sep 2020 12:25:09 +0000 (-0700) Subject: bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128) X-Git-Tag: v3.9.0rc2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6a39888c2c4bcfbcdc61a1953911ad30c62da1ef;p=thirdparty%2FPython%2Fcpython.git 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 (cherry picked from commit fa8c9e70104b0aef966a518eb3a80a4881906ae0) Co-authored-by: Jakub KulĂ­k --- diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 39f5f577a828..01e8bcbd2981 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -9456,14 +9456,13 @@ done: #if defined(__sun) && defined(__SVR4) // On Solaris, sendfile raises EINVAL rather than returning 0 // when the offset is equal or bigger than the in_fd size. - int res; struct stat st; do { Py_BEGIN_ALLOW_THREADS - res = fstat(in_fd, &st); + ret = fstat(in_fd, &st); 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) return (!async_err) ? posix_error() : NULL;