Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Reduce the number of time when we call lchflags
Baptiste Daroussin committed 10 years ago
commit 4df52ca1ae3f8030ae0c5610e27ac0efc9588612
parent 745f5d6
1 file changed +3 -2
modified libpkg/pkg_add.c
@@ -346,7 +346,7 @@ do_extract(struct archive *a, struct archive_entry *ae, const char *location,
			if (rename(rpath, pathname) == -1) {
#ifdef HAVE_CHFLAGS
				/* restore flags */
-
				if (old)
+
				if (old && st.st_flags != 0)
					lchflags(pathname, st.st_flags);
#endif
				pkg_emit_error("cannot rename %s to %s: %s", rpath, pathname,
@@ -363,7 +363,8 @@ do_extract(struct archive *a, struct archive_entry *ae, const char *location,
		}
#ifdef HAVE_CHFLAGS
		/* Restore flags */
-
		lchflags(pathname, set);
+
		if (set != 0)
+
			lchflags(pathname, set);
#endif

		if (string_end_with(pathname, ".pkgnew"))