Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Stop adding the CLOEXEC flag to pkg's rootfd.
Baptiste Daroussin committed 6 years ago
commit ae4843a553bbab7b9d6a9053faf2a6f233916990
parent db8cfab
1 file changed +2 -6
modified libpkg/pkg.c
@@ -1685,11 +1685,7 @@ 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(ctx.rootfd, F_DUPFD_CLOEXEC, 0)) == -1) {
-
#else
-
		if ((pkg->rootfd = dup(ctx.rootfd)) == -1 || fcntl(pkg->rootfd, F_SETFD, FD_CLOEXEC) == -1) {
-
#endif
+
		if ((pkg->rootfd = dup(ctx.rootfd)) == -1) {
			pkg_emit_errno("dup2", "rootfd");
			return (EPKG_FATAL);
		}
@@ -1698,7 +1694,7 @@ pkg_open_root_fd(struct pkg *pkg)

	pkg_absolutepath(path, pkg->rootpath, sizeof(pkg->rootpath), false);

-
	if ((pkg->rootfd = openat(ctx.rootfd, pkg->rootpath + 1, O_DIRECTORY|O_CLOEXEC)) >= 0 )
+
	if ((pkg->rootfd = openat(ctx.rootfd, pkg->rootpath + 1, O_DIRECTORY)) >= 0 )
		return (EPKG_OK);

	pkg->rootpath[0] = '\0';