]> Savannah Git Hosting - gnulib.git/commitdiff
ftruncate: Use _chsize, not chsize.
authorBruno Haible <bruno@clisp.org>
Sun, 9 Aug 2020 20:59:26 +0000 (22:59 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 9 Aug 2020 20:59:26 +0000 (22:59 +0200)
* m4/ftruncate.m4 (gl_PREREQ_FTRUNCATE): Test for _chsize, not chsize.
* lib/ftruncate.c: Test HAVE__CHSIZE.
(chsize_nothrow): Use _chsize, not chsize.

ChangeLog
lib/ftruncate.c
m4/ftruncate.m4

index 10697a729ff8bd09b1033fdba6f50efa531e4cda..cced35ba8aa7145c8c373983faad161fc8196585 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2020-08-09  Bruno Haible  <bruno@clisp.org>
+
+       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  <bruno@clisp.org>
 
        Silence warnings from clang 10 with -Wimplicit-fallthrough.
index 2514075e519623e77f433890b3d318e9b2c94ae9..a9b9185f4a4922ca2f93daaf8fc7b0a939623c1d 100644 (file)
 /* Specification.  */
 #include <unistd.h>
 
-#if HAVE_CHSIZE
+#if HAVE__CHSIZE
 /* A native Windows platform.  */
 
 # include <errno.h>
 
 # 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 <windows.h> 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
index 041f542b8e2f3c417873f166d977b74d907f2d37..752b0dd4ebb0ba99aa46e8f2a5e093726282da0c 100644 (file)
@@ -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])
 ])