]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-41687: Fix error handling in Solaris sendfile implementation (GH-22128)
authorJakub Kulík <Kulikjak@gmail.com>
Wed, 9 Sep 2020 19:29:42 +0000 (21:29 +0200)
committerGitHub <noreply@github.com>
Wed, 9 Sep 2020 19:29:42 +0000 (12:29 -0700)
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
Modules/posixmodule.c

index 00ba7580302bbab6638ae7ad613c36ab665db6e9..7c496938ed4c5e5aba49ed592ec0baa8436d9e05 100644 (file)
@@ -9521,14 +9521,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;