]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use '#include <sys/stat.h>' for the stat structure definition
authorMark Andrews <marka@isc.org>
Mon, 20 Sep 2021 07:33:56 +0000 (17:33 +1000)
committerMark Andrews <marka@isc.org>
Tue, 12 Oct 2021 23:50:07 +0000 (23:50 +0000)
POSIX.1-2008 changed the st_atim, st_mtim, and st_ctime members of the
struct stat from time_t to struct timespec and because not all operating
systems already implemented this version of the standard or historically
deviated to include own nanosecond precision in the structure.

The autoconf script used to include <sys/fcntl.h> which contradicts
POSIX.1 as it mandates <sys/stat.h> inclusion.  Change the autoconf
check to include <sys/stat.h>.

Also fix the missing AC_MSG_RESULT([yes/no]) in the check.

configure.ac

index 543ed9ba195e26e5e8543eda6c4a5a034f4703f5..a582ad33a492c678d048e8108cb5fe74a18e2026 100644 (file)
@@ -1058,11 +1058,13 @@ AC_COMPILE_IFELSE(
 AC_MSG_CHECKING([for st_mtim.tv_nsec])
 AC_COMPILE_IFELSE(
   [AC_LANG_PROGRAM(
-     [[#include <sys/fcntl.h>]],
+     [[#include <sys/stat.h>]],
      [[struct stat s;
        return(s.st_mtim.tv_nsec);
       ]])],
-   [AC_DEFINE([HAVE_STAT_NSEC], [1], [define if struct stat has st_mtim.tv_nsec field])])
+  [AC_MSG_RESULT([yes])
+   AC_DEFINE([HAVE_STAT_NSEC], [1], [define if struct stat has st_mtim.tv_nsec field])],
+  [AC_MSG_RESULT([no])])
 
 #
 # Check for if_nametoindex() for IPv6 scoped addresses support