crt: Fix POSIX stat() with 32-bit st_size for pre-msvcr100 build
For POSIX stat compatibility, it is not possible to use msvcrt _stat32() or
_stat64i32() from crtdll.dll - msvcr100.dll CRT libraries as their
implementations do not signal EOVERFLOW error when file size does not fit
into the stat's st_size field. Signalling EOVERFLOW is required for POSIX
compatibility. New CRT libraries (msvcr110.dll, msvcr120.dll and UCRT) have
implementation of _stat32() and _stat64i32() more compatible with POSIX and
properly return EOVERFLOW when file size does not fit into the struct
stat's st_size field.
So for pre-msvcr110 builds, use only _stat64() function for implementing
POSIX stat in mingw-w64 and do check overflow in mingw-w64 the wrapper.
Signed-off-by: Martin Storsjö <martin@martin.st>
9 files changed