Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Completly reset all flags during operations on files with immutables flags
Baptiste Daroussin committed 11 years ago
commit 93d1647d0b986e4c6ad317c4e96886784477dcfe
parent a31d851
2 files changed +5 -6
modified libpkg/pkg_add.c
@@ -262,12 +262,12 @@ do_extract(struct archive *a, struct archive_entry *ae, const char *location,
#ifdef HAVE_CHFLAGS
			bool old = false;
			if (aest->st_flags & NOCHANGESFLAGS)
-
				chflags(rpath, aest->st_flags & ~NOCHANGESFLAGS);
+
				chflags(rpath, 0);

			if (lstat(pathname, &st) != -1) {
				old = true;
				if (st.st_flags & NOCHANGESFLAGS)
-
					chflags(pathname, aest->st_flags & ~NOCHANGESFLAGS);
+
					chflags(pathname, 0);
			}
#endif

modified libpkg/pkg_delete.c
@@ -198,13 +198,12 @@ rmdir_p(struct pkgdb *db, struct pkg *pkg, char *dir, const char *prefix_r)
	if (fstatat(pkg->rootfd, dir, &st, AT_SYMLINK_NOFOLLOW) != -1) {
		if (st.st_flags & NOCHANGESFLAGS)
#ifdef HAVE_CHFLAGSAT
-
			chflagsat(pkg->rootfd, dir,
-
			    st.st_flags & ~NOCHANGESFLAGS,
-
			    AT_SYMLINK_NOFOLLOW);
+
			/* Disable all flags*/
+
			chflagsat(pkg->rootfd, dir, 0, AT_SYMLINK_NOFOLLOW);
#else
			fd = openat(pkg->rootfd, dir, O_NOFOLLOW);
			if (fd > 0) {
-
				fchflags(fd, st.st_flags & ~NOCHANGESFLAGS);
+
				fchflags(fd, 0);
				close(fd);
			}
#endif