]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: fix issue with HAVE_FALLOCATE on centos5
authorPádraig Brady <P@draigBrady.com>
Wed, 25 Jan 2017 11:09:03 +0000 (11:09 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 25 Jan 2017 18:24:29 +0000 (18:24 +0000)
* src/copy.c (punch_hole): Work around an empty definition
of HAVE_FALLOCATE which leads to a build error of:
"error: #if with no expression"
That was triggered by the inclusion of <linux/fs.h> in
commit v8.25-68-g89e1fef with kernel-headers-2.6.18.
Reported by Nelson H. F. Beebe

src/copy.c

index c3d71cbc8ff0f6d30c96b476d144a39d46fec201..e3832c23a010f02848764b2d22b181bea6ad2119 100644 (file)
@@ -75,6 +75,7 @@
 # include <linux/falloc.h>
 #endif
 
+/* See HAVE_FALLOCATE workaround when including this file.  */
 #ifdef HAVE_LINUX_FS_H
 # include <linux/fs.h>
 #endif
@@ -166,7 +167,8 @@ static int
 punch_hole (int fd, off_t offset, off_t length)
 {
   int ret = 0;
-#if HAVE_FALLOCATE
+/* +0 is to work around older <linux/fs.h> defining HAVE_FALLOCATE to empty.  */
+#if HAVE_FALLOCATE + 0
 # if defined FALLOC_FL_PUNCH_HOLE && defined FALLOC_FL_KEEP_SIZE
   ret = fallocate (fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
                    offset, length);