From 444acd314f6c4a1fb7ea7412a54b8ea5fc0ad7c2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 9 Aug 2020 22:59:26 +0200 Subject: [PATCH] ftruncate: Use _chsize, not chsize. * m4/ftruncate.m4 (gl_PREREQ_FTRUNCATE): Test for _chsize, not chsize. * lib/ftruncate.c: Test HAVE__CHSIZE. (chsize_nothrow): Use _chsize, not chsize. --- ChangeLog | 7 +++++++ lib/ftruncate.c | 8 ++++---- m4/ftruncate.m4 | 6 +++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 10697a729f..cced35ba8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2020-08-09 Bruno Haible + + ftruncate: Use _chsize, not chsize. + * m4/ftruncate.m4 (gl_PREREQ_FTRUNCATE): Test for _chsize, not chsize. + * lib/ftruncate.c: Test HAVE__CHSIZE. + (chsize_nothrow): Use _chsize, not chsize. + 2020-08-09 Bruno Haible Silence warnings from clang 10 with -Wimplicit-fallthrough. diff --git a/lib/ftruncate.c b/lib/ftruncate.c index 2514075e51..a9b9185f4a 100644 --- a/lib/ftruncate.c +++ b/lib/ftruncate.c @@ -19,14 +19,14 @@ /* Specification. */ #include -#if HAVE_CHSIZE +#if HAVE__CHSIZE /* A native Windows platform. */ # include # if _GL_WINDOWS_64_BIT_OFF_T -/* Large File Support: off_t is 64-bit, but chsize() takes only a 32-bit +/* 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. */ /* Ensure that declares GetFileSizeEx. */ @@ -170,7 +170,7 @@ chsize_nothrow (int fd, long length) TRY_MSVC_INVAL { - result = chsize (fd, length); + result = _chsize (fd, length); } CATCH_MSVC_INVAL { @@ -182,7 +182,7 @@ chsize_nothrow (int fd, long length) return result; } # else -# define chsize_nothrow chsize +# define chsize_nothrow _chsize # endif int diff --git a/m4/ftruncate.m4 b/m4/ftruncate.m4 index 041f542b8e..752b0dd4eb 100644 --- a/m4/ftruncate.m4 +++ b/m4/ftruncate.m4 @@ -1,6 +1,6 @@ -# serial 20 +# serial 21 -# See if we need to emulate a missing ftruncate function using chsize. +# See if we need to emulate a missing ftruncate function using _chsize. # Copyright (C) 2000-2001, 2003-2007, 2009-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -36,5 +36,5 @@ AC_DEFUN([gl_FUNC_FTRUNCATE], # Prerequisites of lib/ftruncate.c. AC_DEFUN([gl_PREREQ_FTRUNCATE], [ - AC_CHECK_FUNCS([chsize]) + AC_CHECK_FUNCS([_chsize]) ]) -- 2.39.5