Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Merge pull request #1434 from peikk0/1431-fix-fallback-logic-for-syscalls
Baptiste Daroussin committed 9 years ago
commit f5a0af9ebdc10894a01d44b1183ecba54b6dd41d
parent 9b99349
1 file changed +10 -7
modified libpkg/pkg_add.c
@@ -240,10 +240,11 @@ set_attrs(int fd, char *path, mode_t perm, uid_t uid, gid_t gid,
	if (getenv("INSTALL_AS_USER") == NULL) {
		if (fchownat(fd, RELATIVE_PATH(path), uid, gid,
				AT_SYMLINK_NOFOLLOW) == -1) {
-
			if (errno == ENOTSUP &&
-
					fchownat(fd, RELATIVE_PATH(path), uid, gid, 0) == -1) {
-
				pkg_emit_error("Fail to chown(fallback) %s: %s", path, strerror(errno));
-
				return (EPKG_FATAL);
+
			if (errno == ENOTSUP) {
+
				if (fchownat(fd, RELATIVE_PATH(path), uid, gid, 0) == -1) {
+
					pkg_emit_error("Fail to chown(fallback) %s: %s", path, strerror(errno));
+
					return (EPKG_FATAL);
+
				}
			}
			else {
				pkg_emit_error("Fail to chown %s: %s", path, strerror(errno));
@@ -254,9 +255,11 @@ set_attrs(int fd, char *path, mode_t perm, uid_t uid, gid_t gid,

	/* zfs drops the setuid on fchownat */
	if (fchmodat(fd, RELATIVE_PATH(path), perm, AT_SYMLINK_NOFOLLOW) == -1) {
-
		if (errno == ENOTSUP && fchmodat(fd, RELATIVE_PATH(path), perm, 0) == -1) {
-
			pkg_emit_error("Fail to chmod(fallback) %s: %s", path, strerror(errno));
-
			return (EPKG_FATAL);
+
		if (errno == ENOTSUP) {
+
			if (fchmodat(fd, RELATIVE_PATH(path), perm, 0) == -1) {
+
				pkg_emit_error("Fail to chmod(fallback) %s: %s", path, strerror(errno));
+
				return (EPKG_FATAL);
+
			}
		}
		else {
			pkg_emit_error("Fail to chmod %s: %s", path, strerror(errno));