make tar restore mode again
authorDenis Vlasenko <vda.linux@googlemail.com>
Mon, 12 Feb 2007 22:06:56 +0000 (22:06 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Mon, 12 Feb 2007 22:06:56 +0000 (22:06 -0000)
archival/libunarchive/data_extract_all.c

index 25bf028d2d9c1b6e4c368ada4cf36e6ebffdf1ec..0bb5bfe33d23531b3be16c8df46249bde3dbee3e 100644 (file)
@@ -110,6 +110,14 @@ void data_extract_all(archive_handle_t *archive_handle)
        if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_OWN)) {
                lchown(file_header->name, file_header->uid, file_header->gid);
        }
+       /* uclibc has no lchmod, glibc is even stranger -
+        * it has lchmod which seems to do nothing!
+        * so we use chmod... */
+       if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_PERM)
+        && (file_header->mode & S_IFMT) != S_IFLNK
+       ) {
+               chmod(file_header->name, file_header->mode);
+       }
 
        if (archive_handle->flags & ARCHIVE_PRESERVE_DATE) {
                struct utimbuf t;