From: Luis R. Rodriguez Date: Thu, 9 Nov 2017 17:35:21 +0000 (-0600) Subject: build: define _DEFAULT_SOURCE with _BSD_SOURCE for preadv X-Git-Tag: v4.14.0-rc1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c143657382578abfb77e22e2dc9c3b175d55325a;p=thirdparty%2Fxfsprogs-dev.git build: define _DEFAULT_SOURCE with _BSD_SOURCE for preadv _BSD_SOURCE has been deprecated and replaced with _DEFAULT_SOURCE for feature test macros. We use this for preadv in the configure script, but the latest preadv(2) manpage says: preadv(), pwritev(): since glibc 2.19: _DEFAULT_SOURCE Glibc 2.19 and earlier: _BSD_SOURCE and the latest feature_test_macros(7) manpage says: Since glibc 2.20, this macro is deprecated. It now has the same effect as defining _DEFAULT_SOURCE, but generates a compile-time warning (unless _DEFAULT_SOURCE is also defined). Use _DEFAULT_SOURCE instead. To allow code that requires _BSD_SOURCE in glibc 2.19 and earlier and _DEFAULT_SOURCE in glibc 2.20 and later to compile without warnings, define both _BSD_SOURCE and _DEFAULT_SOURCE. So add both to our configure test. They were completely missing from the actual preadv usage in xfs_io, so add them there too. Signed-off-by: Luis R. Rodriguez Reviewed-by: Eric Sandeen [sandeen@redhat.com: clarify changelog, add defines to code use too] Signed-off-by: Eric Sandeen --- diff --git a/io/pread.c b/io/pread.c index 339550360..7591276df 100644 --- a/io/pread.c +++ b/io/pread.c @@ -16,6 +16,8 @@ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#define _BSD_SOURCE +#define _DEFAULT_SOURCE #include #include "command.h" #include "input.h" diff --git a/m4/package_libcdev.m4 b/m4/package_libcdev.m4 index fa5b63978..af2a9631b 100644 --- a/m4/package_libcdev.m4 +++ b/m4/package_libcdev.m4 @@ -137,6 +137,7 @@ AC_DEFUN([AC_HAVE_PREADV], [ AC_MSG_CHECKING([for preadv]) AC_TRY_LINK([ #define _BSD_SOURCE +#define _DEFAULT_SOURCE #include ], [ preadv(0, 0, 0, 0);