From c143657382578abfb77e22e2dc9c3b175d55325a Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Thu, 9 Nov 2017 11:35:21 -0600 Subject: [PATCH] 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 --- io/pread.c | 2 ++ m4/package_libcdev.m4 | 1 + 2 files changed, 3 insertions(+) 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); -- 2.47.2