[PATCH] busybox: fix coding style of ENABLE_FEATURE_TAR_UNAME_GNAME

Thomas Chou thomas at wytron.com.tw
Mon May 11 06:59:43 UTC 2009


The gcc-3.4.6 (nios2) cannot optimize out the def in the if
conitional. Even if the def equals to zero.

Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
---
 .../archival/libunarchive/data_extract_all.c       |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/busybox/archival/libunarchive/data_extract_all.c b/busybox/archival/libunarchive/data_extract_all.c
index a2dfcb9..bec50ca 100644
--- a/busybox/archival/libunarchive/data_extract_all.c
+++ b/busybox/archival/libunarchive/data_extract_all.c
@@ -114,12 +114,11 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
 	}
 
 	if (!(archive_handle->ah_flags & ARCHIVE_NOPRESERVE_OWN)) {
-		if (ENABLE_FEATURE_TAR_UNAME_GNAME
-		 && !(archive_handle->ah_flags & ARCHIVE_NUMERIC_OWNER)
-		) {
-			uid_t uid = file_header->uid;
-			gid_t gid = file_header->gid;
+		uid_t uid = file_header->uid;
+		gid_t gid = file_header->gid;
 
+#if ENABLE_FEATURE_TAR_UNAME_GNAME
+		if (!(archive_handle->ah_flags & ARCHIVE_NUMERIC_OWNER)) {
 			if (file_header->uname) {
 				struct passwd *pwd = getpwnam(file_header->uname);
 				if (pwd) uid = pwd->pw_uid;
@@ -128,10 +127,9 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
 				struct group *grp = getgrnam(file_header->gname);
 				if (grp) gid = grp->gr_gid;
 			}
-			lchown(file_header->name, uid, gid);
-		} else {
-			lchown(file_header->name, file_header->uid, file_header->gid);
 		}
+#endif
+		lchown(file_header->name, uid, gid);
 	}
 	if ((file_header->mode & S_IFMT) != S_IFLNK) {
 		/* uclibc has no lchmod, glibc is even stranger -
-- 
1.6.2.2



More information about the busybox mailing list