Only use pread64 on Linux

This commit is contained in:
Kovid Goyal 2025-04-08 20:11:21 +05:30
parent a00d61d921
commit 591bbcbb63
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -748,9 +748,13 @@ pread_all(PyObject *self, PyObject *args) {
break;
}
#else
#ifdef __linux__
ssize_t nr = pread64(fd, buf + pos, n - pos, offset);
#else
ssize_t nr = pread(fd, buf + pos, n - pos, offset);
#endif
if (nr < 0) {
if (errno == EINTR || errno == EAGAIN || errno == EBUSY) continue;
if (errno == EINTR || errno == EAGAIN) continue;
saved_errno = errno;
break;
} else if (nr == 0) break;