]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
build: define _DEFAULT_SOURCE with _BSD_SOURCE for preadv
authorLuis R. Rodriguez <mcgrof@kernel.org>
Thu, 9 Nov 2017 17:35:21 +0000 (11:35 -0600)
committerEric Sandeen <sandeen@redhat.com>
Thu, 9 Nov 2017 17:35:21 +0000 (11:35 -0600)
_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 <mcgrof@kernel.org>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
[sandeen@redhat.com: clarify changelog, add defines to code use too]
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
io/pread.c
m4/package_libcdev.m4

index 339550360d27e98af14074fcfee83645df7da14b..7591276df996c8de2ef4145659ad264cf24d00ff 100644 (file)
@@ -16,6 +16,8 @@
  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#define _BSD_SOURCE
+#define _DEFAULT_SOURCE
 #include <sys/uio.h>
 #include "command.h"
 #include "input.h"
index fa5b6397879771a276095f168b74e01e18e35985..af2a9631b8ba2cdb47a56a994848f10695896836 100644 (file)
@@ -137,6 +137,7 @@ AC_DEFUN([AC_HAVE_PREADV],
   [ AC_MSG_CHECKING([for preadv])
     AC_TRY_LINK([
 #define _BSD_SOURCE
+#define _DEFAULT_SOURCE
 #include <sys/uio.h>
     ], [
          preadv(0, 0, 0, 0);