Radish alpha
H
HardenedBSD Package Manager
Radicle
Git (anonymous pull)
Log in to clone via SSH
Reduce the number of time when we call lchflags
Baptiste Daroussin committed 10 years ago
commit 4df52ca1ae3f8030ae0c5610e27ac0efc9588612
parent 745f5d611b87cdb0de9a6d26e74126ed0ada1f2a
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"))