From: Bruno Haible Date: Thu, 14 Nov 2024 03:32:09 +0000 (+0100) Subject: ftruncate: Accept lengths > 2 GiB on 32-bit mingw. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=5aa62b965e4865d3cc116355f296f1ae8d32d083;p=gnulib.git ftruncate: Accept lengths > 2 GiB on 32-bit mingw. * lib/ftruncate.c: Test whether module 'largefile' is in use, not whether it had to override 'off_t'. --- diff --git a/ChangeLog b/ChangeLog index b331423142..e2f55b9ad8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2024-11-14 Bruno Haible + + ftruncate: Accept lengths > 2 GiB on 32-bit mingw. + * lib/ftruncate.c: Test whether module 'largefile' is in use, not + whether it had to override 'off_t'. + 2024-11-12 Bruno Haible gnulib-tool.py: Fix logic of --remove-import option. diff --git a/lib/ftruncate.c b/lib/ftruncate.c index 6394725781..0566c32d0e 100644 --- a/lib/ftruncate.c +++ b/lib/ftruncate.c @@ -24,10 +24,12 @@ # include -# if _GL_WINDOWS_64_BIT_OFF_T +# if _FILE_OFFSET_BITS == 64 /* set by module 'largefile' on all platforms */ /* Large File Support: off_t is 64-bit, but _chsize() takes only a 32-bit - argument. So, define a 64-bit safe SetFileSize function ourselves. */ + argument. Some newer versions of the Windows CRT have a _chsize_s function + that takes a 64-bit argument, but we cannot rely on that. + So, define a 64-bit safe SetFileSize function ourselves. */ /* Ensure that declares GetFileSizeEx. */ # if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN2K)