When _FILE_OFFSET_BITS is set to 64 then all off_t-based function should be 64-bit and should take 64-bit off_t type.
To prevent 937a015346f7507615299b194a42eb8e2918fa38 issues, define redirection from truncate() to truncate64() via __MINGW_ASM_CALL macro. Use off_t type (instead of _off_t) for offset parameter. off_t type follows the _FILE_OFFSET_BITS setting. _off_t type is always 32-bit. --- mingw-w64-headers/crt/unistd.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mingw-w64-headers/crt/unistd.h b/mingw-w64-headers/crt/unistd.h index c408e8fa9caf..b9f1a7836e0d 100644 --- a/mingw-w64-headers/crt/unistd.h +++ b/mingw-w64-headers/crt/unistd.h @@ -62,7 +62,11 @@ __MINGW_ASM_CALL(ftruncate64) #endif ; int ftruncate64(int, _off64_t); -int truncate(const char *, _off_t); +int truncate(const char *, off_t) +#if (defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64)) +__MINGW_ASM_CALL(truncate64) +#endif +; int truncate64(const char *, _off64_t); #endif /* FTRUNCATE_DEFINED */ -- 2.20.1 _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
