Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Test struct members for flags support
Baptiste Daroussin committed 7 years ago
commit 8d716439522ded43cf3fc1be187dff2e878880cb
parent 1cbf635
2 files changed +6 -6
modified auto.def
@@ -123,7 +123,7 @@ cc-with { -includes netinet/in.h } {
}

cc-with { -includes sys/stat.h } {
-
	cc-check-members "struct stat.st_mtim"
+
	cc-check-members "struct stat.st_mtim" "struct stat.st_flags"
}

# check for sqlite
@@ -131,7 +131,7 @@ cc-check-functions gmtime_r isnan localtime_r strchrnul strerror_r
cc-check-includes stdint.h inttypes.h

# check for pkg itself
-
cc-check-functions arc4random arc4random_stir basename_r chflags chflagsat \
+
cc-check-functions arc4random arc4random_stir basename_r chflagsat \
	closefrom dirfd eaccess fopencookie fstatfs funopen strnstr \
	strtofflags strtonum sysconf utimensat __res_setservers unlinkat \
	faccessat fstatat openat readlinkat fflagstostr
modified libpkg/pkg_delete.c
@@ -191,7 +191,7 @@ rmdir_p(struct pkgdb *db, struct pkg *pkg, char *dir, const char *prefix_r)
	int64_t cnt;
	char fullpath[MAXPATHLEN];
	size_t len;
-
#if defined(HAVE_CHFLAGS)
+
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
	struct stat st;
#if !defined(HAVE_CHFLAGSAT)
	int fd;
@@ -220,7 +220,7 @@ rmdir_p(struct pkgdb *db, struct pkg *pkg, char *dir, const char *prefix_r)
		return;

	pkg_debug(1, "removing directory %s", fullpath);
-
#ifdef HAVE_CHFLAGS
+
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
	if (fstatat(pkg->rootfd, dir, &st, AT_SYMLINK_NOFOLLOW) != -1) {
		if (st.st_flags & NOCHANGESFLAGS) {
#ifdef HAVE_CHFLAGSAT
@@ -283,7 +283,7 @@ pkg_delete_file(struct pkg *pkg, struct pkg_file *file, unsigned force)
	const char *path;
	const char *prefix_rel;
	size_t len;
-
#if defined(HAVE_CHFLAGS)
+
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
	struct stat st;
#if !defined(HAVE_CHFLAGSAT)
	int fd;
@@ -300,7 +300,7 @@ pkg_delete_file(struct pkg *pkg, struct pkg_file *file, unsigned force)
	while (len > 0 && prefix_rel[len - 1] == '/')
		len--;

-
#ifdef HAVE_CHFLAGS
+
#ifdef HAVE_STRUCT_STAT_ST_FLAGS
	if (fstatat(pkg->rootfd, path, &st, AT_SYMLINK_NOFOLLOW) != -1) {
		if (st.st_flags & NOCHANGESFLAGS) {
#ifdef HAVE_CHFLAGSAT