[Python-checkins] bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)

Jakub Kulík webhook-mailer at python.org
Tue Sep 15 09:44:53 EDT 2020


https://github.com/python/cpython/commit/fa8c9e70104b0aef966a518eb3a80a4881906ae0
commit: fa8c9e70104b0aef966a518eb3a80a4881906ae0
branch: master
author: Jakub Kulík <Kulikjak at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-09-09T12:29:42-07:00
summary:

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

files:
M Modules/posixmodule.c

diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 00ba7580302bb..7c496938ed4c5 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -9521,14 +9521,13 @@ os_sendfile_impl(PyObject *module, int out_fd, int in_fd, PyObject *offobj,
 #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;
 



More information about the Python-checkins mailing list