build: tidy up local lseek() mappings

- stop redefining system symbol `lseek`, by introducing `curl_lseek()`.
- handle AmigaOS quirk within the macro mapping.
- add missing parenthesis to `LSEEK_ERROR` values.
- tool_util: use curl `lseek` macros in `tool_ftruncate64()`.
- move `LSEEK_ERROR` to right-hand side of if expressions.
- checksrc: disallow direct uses of `_lseeki64`, `llseek`, `lseek`.

Closes #20488
This commit is contained in:
Viktor Szakats 2026-02-01 01:04:58 +01:00
parent 47734f3244
commit 96fa42c7c0
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
7 changed files with 24 additions and 27 deletions

View file

@ -490,28 +490,28 @@
# include <sys/types.h>
# include <sys/stat.h>
/* Large file (>2Gb) support using Win32 functions. */
# undef lseek
# define lseek(fdes, offset, whence) _lseeki64(fdes, offset, whence)
# undef fstat
# define fstat(fdes, stp) _fstati64(fdes, stp)
# define struct_stat struct _stati64
# define LSEEK_ERROR (__int64)-1
# define fstat(fdes, stp) _fstati64(fdes, stp)
# define struct_stat struct _stati64
# define curl_lseek _lseeki64
# define LSEEK_ERROR ((__int64)-1)
#elif defined(__DJGPP__)
/* Requires DJGPP 2.04 */
# include <unistd.h>
# undef lseek
# define lseek(fdes, offset, whence) llseek(fdes, offset, whence)
# define LSEEK_ERROR (offset_t)-1
# define curl_lseek llseek
# define LSEEK_ERROR ((offset_t)-1)
#elif defined(__AMIGA__)
# define curl_lseek(fd, offset, whence) lseek(fd, (off_t)(offset), whence)
# define LSEEK_ERROR ((off_t)-1)
#else
# define curl_lseek lseek
# define LSEEK_ERROR ((off_t)-1)
#endif
#ifndef struct_stat
#define struct_stat struct stat
#endif
#ifndef LSEEK_ERROR
#define LSEEK_ERROR (off_t)-1
#endif
#ifndef SIZEOF_TIME_T
/* assume default size of time_t to be 32 bits */
#define SIZEOF_TIME_T 4