build: tidy up curl-specific fstat calls and stat struct type

To avoid redefining the `fstat` system symbol, and to clarify
`struct_stat` is a curl symbol.

- introduce `curlx_fstat()` macro and use it.
- rename `struct_stat` to `curl_struct_stat`.

Also:
- tests: replace direct `curlx_win32_stat()` call with `curlx_stat()`.
- checksrc: disallow direct `_fstati64` and `fstat()` calls, except in
  examples.

Closes #20496
This commit is contained in:
Viktor Szakats 2026-02-02 13:14:30 +01:00
parent 9630593650
commit a84b041281
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
22 changed files with 53 additions and 50 deletions

View file

@ -122,13 +122,13 @@ static struct tool_mime *tool_mime_new_filedata(struct tool_mime *parent,
char *data = NULL;
curl_off_t size;
curl_off_t origin;
struct_stat sbuf;
curl_struct_stat sbuf;
CURLX_SET_BINMODE(stdin);
origin = ftell(stdin);
/* If stdin is a regular file, do not buffer data but read it
when needed. */
if(fd >= 0 && origin >= 0 && !fstat(fd, &sbuf) &&
if(fd >= 0 && origin >= 0 && !curlx_fstat(fd, &sbuf) &&
#ifdef __VMS
sbuf.st_fab_rfm != FAB$C_VAR && sbuf.st_fab_rfm != FAB$C_VFC &&
#endif