From 95673ba9cf8c95f7eb651eaf7507632f0ee8f179 Mon Sep 17 00:00:00 2001 From: Oleksiy Yakovenko Date: Sat, 4 May 2024 13:57:55 +0200 Subject: [PATCH] vfs_stdio: explicit use of lseek64/off64_t where possible (potentially fixing #3070) --- src/vfs_stdio.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/vfs_stdio.c b/src/vfs_stdio.c index 0c6591b0e2..3c60287959 100644 --- a/src/vfs_stdio.c +++ b/src/vfs_stdio.c @@ -34,10 +34,15 @@ #include #include -#ifndef __linux__ +#if !defined(__linux__) #define O_LARGEFILE 0 #endif +#if !defined(__linux__) || !defined(__GLIBC__) +#define off64_t off_t +#define lseek64 lseek +#endif + //#define USE_STDIO #define USE_BUFFERING @@ -167,7 +172,7 @@ stdio_seek (DB_FILE *stream, int64_t offset, int whence) { whence = SEEK_SET; offset = ((STDIO_FILE*)stream)->offs + offset; } - off_t res = lseek (((STDIO_FILE *)stream)->stream, offset, whence); + off64_t res = lseek64 (((STDIO_FILE *)stream)->stream, offset, whence); if (res == -1) { return -1; } @@ -212,8 +217,8 @@ stdio_getlength (DB_FILE *stream) { return l; #else if (!f->have_size) { - off_t size = lseek (f->stream, 0, SEEK_END); - lseek (f->stream, f->offs, SEEK_SET); + off64_t size = lseek64 (f->stream, 0, SEEK_END); + lseek64 (f->stream, f->offs, SEEK_SET); #ifdef USE_BUFFERING f->bufremaining = 0; #endif