libunarchive: fix build failure with !FEATURE_TAR_UNAME_GNAME
authorMike Frysinger <vapier@gentoo.org>
Tue, 5 May 2009 11:00:27 +0000 (07:00 -0400)
committerMike Frysinger <vapier@gentoo.org>
Tue, 5 May 2009 11:00:27 +0000 (07:00 -0400)
We can't use C if(...) with ENABLE_FEATURE_TAR_UNAME_GNAME because it
relies on conditional members in the file_header_t structure:

archival/libunarchive/data_extract_all.c: In function ‘data_extract_all’:
archival/libunarchive/data_extract_all.c:123: error: ‘file_header_t’ has no member named ‘uname’
archival/libunarchive/data_extract_all.c:124: error: ‘file_header_t’ has no member named ‘uname’
archival/libunarchive/data_extract_all.c:127: error: ‘file_header_t’ has no member named ‘gname’
archival/libunarchive/data_extract_all.c:128: error: ‘file_header_t’ has no member named ‘gname’
make[1]: *** [archival/libunarchive/data_extract_all.o] Error 1

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
archival/libunarchive/data_extract_all.c

index a2dfcb9e1829e10dccd775ae57261c3781699df7..444770d2783c3e6ce5a514e66ed81f4a87ab10fc 100644 (file)
@@ -114,9 +114,8 @@ 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)
-               ) {
+#if ENABLE_FEATURE_TAR_UNAME_GNAME
+               if (!(archive_handle->ah_flags & ARCHIVE_NUMERIC_OWNER)) {
                        uid_t uid = file_header->uid;
                        gid_t gid = file_header->gid;
 
@@ -129,9 +128,9 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
                                if (grp) gid = grp->gr_gid;
                        }
                        lchown(file_header->name, uid, gid);
-               } else {
+               } else
+#endif
                        lchown(file_header->name, file_header->uid, file_header->gid);
-               }
        }
        if ((file_header->mode & S_IFMT) != S_IFLNK) {
                /* uclibc has no lchmod, glibc is even stranger -