Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Attempt to fix build on osx
Baptiste Daroussin committed 5 years ago
commit e8d60bc54b0044704ab5688ef382b747ca2c5aa5
parent 700cc4d
1 file changed +17 -1
modified libpkg/lua_scripts.c
@@ -117,6 +117,7 @@ lua_pkg_copy(lua_State *L)
	char *buf1, *buf2;
	struct stat s1;
	int fd1, fd2;
+
	struct timespec ts[2];

	bool install_as_user = (getenv("INSTALL_AS_USER") != NULL);

@@ -171,8 +172,23 @@ lua_pkg_copy(lua_State *L)
	close(fd1);
	close(fd2);

+
#ifdef HAVE_STRUCT_STAT_ST_MTIM
+
	ts[0] = s1.st_atim;
+
	ts[1] = s1.st_mtim;
+
#else
+
#if defined(_DARWIN_C_SOURCE) || defined(__APPLE__)
+
	ts[0] = s1.st_atimespec;
+
	ts[1] = s1.st_mtimespec;
+
#else
+
	ts[0].tv_sec = s1.st_atime;
+
	ts[0].tv_nsec = 0;
+
	ts[1].tv_sec = s1.st_mtime;
+
	ts[1].tv_nsec = 0;
+
#endif
+
#endif
+

	if (set_attrsat(pkg->rootfd, RELATIVE_PATH(dst), s1.st_mode, s1.st_uid,
-
	  s1.st_gid, &s1.st_atim, &s1.st_mtim) != EPKG_OK) {
+
	  s1.st_gid, &ts[0], &ts[1]) != EPKG_OK) {
		lua_pushinteger(L, -1);
		return (1);
	}