summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2017-01-25 11:09:03 +0000
committerPádraig Brady <P@draigBrady.com>2017-01-25 18:24:29 +0000
commit7a9c524f15c73d66876854e4049c9d4032e22271 (patch)
treea74f56ea4172155fdd6162871b5d60cfd98c5b80
parentc974f835a52706c05444fcdd229f4fc670c76f47 (diff)
downloadcoreutils-7a9c524f15c73d66876854e4049c9d4032e22271.tar.xz
build: fix issue with HAVE_FALLOCATE on centos5
* 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
-rw-r--r--src/copy.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/copy.c b/src/copy.c
index c3d71cbc8..e3832c23a 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -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);