Support st_nmtime in struct stat as found in HP-UX.

This commit is contained in:
Todd C. Miller
2018-11-14 13:37:46 -07:00
parent 7c5469264d
commit 716aa6e4ab
5 changed files with 27 additions and 3 deletions

View File

@@ -814,6 +814,9 @@
/* Define to 1 if your struct stat has an st_mtimespec member. */ /* Define to 1 if your struct stat has an st_mtimespec member. */
#undef HAVE_ST_MTIMESPEC #undef HAVE_ST_MTIMESPEC
/* Define to 1 if your struct stat has an st_nmtime member. */
#undef HAVE_ST_NMTIME
/* Define to 1 if your struct stat uses an st__tim union. */ /* Define to 1 if your struct stat uses an st__tim union. */
#undef HAVE_ST__TIM #undef HAVE_ST__TIM

10
configure vendored
View File

@@ -20975,8 +20975,17 @@ else
if test "x$ac_cv_member_struct_stat_st_mtimespec" = xyes; then : if test "x$ac_cv_member_struct_stat_st_mtimespec" = xyes; then :
$as_echo "#define HAVE_ST_MTIMESPEC 1" >>confdefs.h $as_echo "#define HAVE_ST_MTIMESPEC 1" >>confdefs.h
else
ac_fn_c_check_member "$LINENO" "struct stat" "st_nmtime" "ac_cv_member_struct_stat_st_nmtime" "$ac_includes_default"
if test "x$ac_cv_member_struct_stat_st_nmtime" = xyes; then :
$as_echo "#define HAVE_ST_NMTIME 1" >>confdefs.h
fi fi
fi
fi fi
# Look for sha2 functions if not using openssl # Look for sha2 functions if not using openssl
@@ -29141,5 +29150,6 @@ fi

View File

@@ -2836,9 +2836,14 @@ AC_CHECK_MEMBERS([struct tm.tm_gmtoff], [], [], [
AC_INCLUDES_DEFAULT AC_INCLUDES_DEFAULT
#include <errno.h> #include <errno.h>
]) ])
AC_CHECK_MEMBER([struct stat.st_mtim], [AC_DEFINE(HAVE_ST_MTIM)] AC_CHECK_MEMBER([struct stat.st_mtim],
[AC_DEFINE(HAVE_ST_MTIM)]
[AC_CHECK_MEMBER([struct stat.st_mtim.st__tim], AC_DEFINE(HAVE_ST__TIM))], [AC_CHECK_MEMBER([struct stat.st_mtim.st__tim], AC_DEFINE(HAVE_ST__TIM))],
[AC_CHECK_MEMBER([struct stat.st_mtimespec], AC_DEFINE([HAVE_ST_MTIMESPEC]))]) [AC_CHECK_MEMBER([struct stat.st_mtimespec],
[AC_DEFINE([HAVE_ST_MTIMESPEC])],
[AC_CHECK_MEMBER([struct stat.st_nmtime], AC_DEFINE(HAVE_ST_NMTIME))])
]
)
# Look for sha2 functions if not using openssl # Look for sha2 functions if not using openssl
if test "$DIGEST" = "digest.lo"; then if test "$DIGEST" = "digest.lo"; then
FOUND_SHA2=no FOUND_SHA2=no
@@ -4578,6 +4583,7 @@ AH_TEMPLATE(HAVE_SOLARIS_AUDIT, [Define to 1 to enable Solaris audit support.])
AH_TEMPLATE(HAVE_ST__TIM, [Define to 1 if your struct stat uses an st__tim union.]) AH_TEMPLATE(HAVE_ST__TIM, [Define to 1 if your struct stat uses an st__tim union.])
AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member.]) AH_TEMPLATE(HAVE_ST_MTIM, [Define to 1 if your struct stat has an st_mtim member.])
AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member.]) AH_TEMPLATE(HAVE_ST_MTIMESPEC, [Define to 1 if your struct stat has an st_mtimespec member.])
AH_TEMPLATE(HAVE_ST_NMTIME, [Define to 1 if your struct stat has an st_nmtime member.])
AH_TEMPLATE(HAVE___PROGNAME, [Define to 1 if your crt0.o defines the __progname symbol for you.]) AH_TEMPLATE(HAVE___PROGNAME, [Define to 1 if your crt0.o defines the __progname symbol for you.])
AH_TEMPLATE(HOST_IN_LOG, [Define to 1 if you want the hostname to be entered into the log file.]) AH_TEMPLATE(HOST_IN_LOG, [Define to 1 if you want the hostname to be entered into the log file.])
AH_TEMPLATE(IGNORE_DOT_PATH, [Define to 1 if you want to ignore '.' and empty PATH elements.]) AH_TEMPLATE(IGNORE_DOT_PATH, [Define to 1 if you want to ignore '.' and empty PATH elements.])

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013-2016 Todd C. Miller <Todd.Miller@sudo.ws> * Copyright (c) 2013-2018 Todd C. Miller <Todd.Miller@sudo.ws>
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@@ -136,6 +136,8 @@
# else # else
# define mtim_get(_x, _y) do { (_y).tv_sec = (_x)->SUDO_ST_MTIM.tv_sec; (_y).tv_nsec = ((_x)->SUDO_ST_MTIM.tv_nsec / 1000) * 1000; } while (0) # define mtim_get(_x, _y) do { (_y).tv_sec = (_x)->SUDO_ST_MTIM.tv_sec; (_y).tv_nsec = ((_x)->SUDO_ST_MTIM.tv_nsec / 1000) * 1000; } while (0)
# endif # endif
#elif defined(HAVE_ST_NMTIME)
# define mtim_get(_x, _y) do { (_y).tv_sec = (_x)->st_mtime; (_y).tv_nsec = (_x)->st_nmtime; } while (0)
#else #else
# define mtim_get(_x, _y) do { (_y).tv_sec = (_x)->st_mtime; (_y).tv_nsec = 0; } while (0) # define mtim_get(_x, _y) do { (_y).tv_sec = (_x)->st_mtime; (_y).tv_nsec = 0; } while (0)
#endif /* HAVE_ST_MTIM */ #endif /* HAVE_ST_MTIM */

View File

@@ -52,6 +52,9 @@
#elif defined(HAVE_ST_MTIMESPEC) #elif defined(HAVE_ST_MTIMESPEC)
# define ATIME_TO_TIMEVAL(_x, _y) TIMESPEC_TO_TIMEVAL((_x), &(_y)->st_atimespec) # define ATIME_TO_TIMEVAL(_x, _y) TIMESPEC_TO_TIMEVAL((_x), &(_y)->st_atimespec)
# define MTIME_TO_TIMEVAL(_x, _y) TIMESPEC_TO_TIMEVAL((_x), &(_y)->st_mtimespec) # define MTIME_TO_TIMEVAL(_x, _y) TIMESPEC_TO_TIMEVAL((_x), &(_y)->st_mtimespec)
#elif defined(HAVE_ST_NMTIME)
# define ATIME_TO_TIMEVAL(_x, _y) do { (_x)->tv_sec = (_y)->st_atime; (_x)->tv_usec = (_y)->st_natime; } while (0)
# define MTIME_TO_TIMEVAL(_x, _y) do { (_x)->tv_sec = (_y)->st_mtime; (_x)->tv_usec = (_y)->st_nmtime; } while (0)
#else #else
# define ATIME_TO_TIMEVAL(_x, _y) do { (_x)->tv_sec = (_y)->st_atime; (_x)->tv_usec = 0; } while (0) # define ATIME_TO_TIMEVAL(_x, _y) do { (_x)->tv_sec = (_y)->st_atime; (_x)->tv_usec = 0; } while (0)
# define MTIME_TO_TIMEVAL(_x, _y) do { (_x)->tv_sec = (_y)->st_mtime; (_x)->tv_usec = 0; } while (0) # define MTIME_TO_TIMEVAL(_x, _y) do { (_x)->tv_sec = (_y)->st_mtime; (_x)->tv_usec = 0; } while (0)