1 https://github.com/python/cpython/pull/23246
3 --- Python-3.7.7/Modules/posixmodule.c.orig 2021-01-08 21:00:38.844294220 +0000
4 +++ Python-3.7.7/Modules/posixmodule.c 2021-01-08 21:14:50.305772937 +0000
6 if (!Py_off_t_converter(offobj, &offset))
9 +#if defined(__sun) && defined(__SVR4)
10 + // On illumos specifically sendfile() may perform a partial write but
11 + // return -1/an error (in one confirmed case the destination socket
12 + // had a 5 second timeout set and errno was EAGAIN) and it's on the client
13 + // code to check if the offset parameter was modified by sendfile().
15 + // We need this variable to track said change.
16 + off_t original_offset = offset;
20 Py_BEGIN_ALLOW_THREADS
21 ret = sendfile(out, in, &offset, count);
22 +#if defined(__sun) && defined(__SVR4)
23 + // This handles illumos-specific sendfile() partial write behavior,
24 + // see a comment above for more details.
25 + if (ret < 0 && offset != original_offset) {
26 + ret = offset - original_offset;
30 } while (ret < 0 && errno == EINTR && !(async_err = PyErr_CheckSignals()));