From: Mike Frysinger Date: Wed, 7 Mar 2012 01:21:36 +0000 (-0500) Subject: libext2fs: check for fallocate symbol before using it X-Git-Tag: v1.42.2~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=800766ee4a2bcdc0a32442d093d20da6ea3815ab;p=thirdparty%2Fe2fsprogs.git libext2fs: check for fallocate symbol before using it If we have newer kernel headers which define FALLOC_FL_PUNCH_HOLE, but we are on an older glibc which lacks fallocate, we end up trying to use the func anyways. Check the ifdef that autoconf already set up for us. Reported-by: Ortwin Glueck Signed-off-by: Mike Frysinger Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c index 9f0613a2b..da3f8fdea 100644 --- a/lib/ext2fs/unix_io.c +++ b/lib/ext2fs/unix_io.c @@ -905,7 +905,7 @@ static errcode_t unix_discard(io_channel channel, unsigned long long block, goto unimplemented; #endif } else { -#ifdef FALLOC_FL_PUNCH_HOLE +#if defined(HAVE_FALLOCATE) && defined(FALLOC_FL_PUNCH_HOLE) /* * If we are not on block device, try to use punch hole * to reclaim free space.