Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Fix setting dates on system not supporting POSIX 2008
Baptiste Daroussin committed 10 years ago
commit f76d3e671969b98bbee4598f21e0874a8961c1d4
parent 4b397475871e9a9a5c4afcfa47838d8fc93cfcee
2 files changed +8 -6
modified configure.ac
@@ -165,6 +165,8 @@ AC_CHECK_FUNCS_ONCE([funopen])
AC_CHECK_FUNCS_ONCE([fopencookie])
AC_CHECK_FUNCS_ONCE([sysctlbyname])
AC_CHECK_FUNCS_ONCE([__res_setservers])
+
AC_CHECK_MEMBERS([struct stat.st_mtim])
+

AC_CHECK_DECLS(
	[[fstatat], [openat], [unlinkat], [readlinkat], [faccessat]],
	[], [], [
modified libpkg/pkg_add.c
@@ -270,7 +270,12 @@ set_attrs(int fd, char *path, mode_t perm, uid_t uid, gid_t gid,
static void
fill_timespec_buf(const struct stat *aest, struct timespec tspec[2])
{
-
#ifdef __APPLE__
+
#ifdef HAVE_STRUCT_STAT_ST_MTIM
+
	tspec[0].tv_sec = aest->st_atim.tv_sec;
+
	tspec[0].tv_nsec = aest->st_atim.tv_nsec;
+
	tspec[1].tv_sec = aest->st_mtim.tv_sec;
+
	tspec[1].tv_nsec = aest->st_mtim.tv_nsec;
+
#else
# ifdef _DARWIN_C_SOURCE
	tspec[0].tv_sec = aest->st_atimespec.tv_sec;
	tspec[0].tv_nsec = aest->st_atimespec.tv_nsec;
@@ -283,11 +288,6 @@ fill_timespec_buf(const struct stat *aest, struct timespec tspec[2])
	tspec[1].tv_sec = aest->st_mtime;
	tspec[1].tv_nsec = 0;
# endif
-
#else
-
	tspec[0].tv_sec = aest->st_atim.tv_sec;
-
	tspec[0].tv_nsec = aest->st_atim.tv_nsec;
-
	tspec[1].tv_sec = aest->st_mtim.tv_sec;
-
	tspec[1].tv_nsec = aest->st_mtim.tv_nsec;
#endif
}