Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
FreeBSD before 9.2 does not have F_DUPFD_CLOEXEC, if it's not present revert to earlier behavior - non-atomic dup().
Kevin Day committed 9 years ago
commit 4e9597dfcf9544598c0290c2c4ab31d31d61cefc
parent 1ff1646
1 file changed +4 -0
modified libpkg/pkg.c
@@ -1783,7 +1783,11 @@ pkg_open_root_fd(struct pkg *pkg)

	path = pkg_kv_get(&pkg->annotations, "relocated");
	if (path == NULL) {
+
#ifdef F_DUPFD_CLOEXEC
		if ((pkg->rootfd = fcntl(rootfd, F_DUPFD_CLOEXEC, 0)) == -1) {
+
#else
+
		if ((pkg->rootfd = dup(rootfd)) == -1) {
+
#endif
			pkg_emit_errno("dup2", "rootfd");
			return (EPKG_FATAL);
		}