From 591bbcbb636d9579f49fb3e45572f6893e23e692 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 8 Apr 2025 20:11:21 +0530 Subject: [PATCH] Only use pread64 on Linux --- src/calibre/utils/speedup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/calibre/utils/speedup.c b/src/calibre/utils/speedup.c index 7249b29953..b605445413 100644 --- a/src/calibre/utils/speedup.c +++ b/src/calibre/utils/speedup.c @@ -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;