Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
compat: sysconf and fstatfs are available on all supported platforms
Baptiste Daroussin committed 3 months ago
commit 2e8e62fd71ff443622833f9fe529a81526428886
parent b47fb74
3 files changed +4 -13
modified auto.def
@@ -178,9 +178,9 @@ cc-check-functions gmtime_r isnan localtime_r strchrnul strerror_r fdatasync \
cc-check-includes stdint.h inttypes.h

# check for pkg itself
-
cc-check-functions arc4random arc4random_stir basename_r chflagsat \
-
	closefrom dirfd eaccess fopencookie fstatfs funopen getprogname strnstr \
-
	strtofflags strtonum sysconf utimensat __res_setservers \
+
cc-check-functions arc4random arc4random_stir chflagsat \
+
	closefrom dirfd eaccess fopencookie funopen getprogname strnstr \
+
	strtofflags strtonum utimensat __res_setservers \
	faccessat fstatat openat readlinkat fflagstostr reallocarray strchrnul \
	copy_file_range

modified compat/closefrom.c
@@ -88,16 +88,7 @@ closefrom(int lowfd)
    } else
#endif
    {
-
	/*
-
	 * Fall back on sysconf() or getdtablesize().  We avoid checking
-
	 * resource limits since it is possible to open a file descriptor
-
	 * and then drop the rlimit such that it is below the open fd.
-
	 */
-
#ifdef HAVE_SYSCONF
	maxfd = sysconf(_SC_OPEN_MAX);
-
#else
-
	maxfd = getdtablesize();
-
#endif /* HAVE_SYSCONF */
	if (maxfd < 0)
	    maxfd = OPEN_MAX;

modified libpkg/pkgdb.c
@@ -983,7 +983,7 @@ pkgdb_is_local_fs(int fd) {
	if (fstatvfs(fd, &stfs) == 0) {
		return (stfs.f_flag & ST_LOCAL);
	}
-
#elif defined(HAVE_FSTATFS) && defined(MNT_LOCAL)
+
#elif defined(MNT_LOCAL)
	struct statfs stfs;
	if (fstatfs(fd, &stfs) == 0) {
		return (stfs.f_flags & MNT_LOCAL);