]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
To be robust when ISO image is broken.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 2 Nov 2009 02:59:56 +0000 (21:59 -0500)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 2 Nov 2009 02:59:56 +0000 (21:59 -0500)
SVN-Revision: 1575

libarchive/archive_read_support_format_iso9660.c
tar/tree.c

index 5d99255839ad7a8cf544de9f50ae9da90a93931c..a913b38d9480bec12c8db7ea444b7b95e4508614 100644 (file)
@@ -1128,12 +1128,25 @@ read_entries(struct archive_read *a)
                /* If rr_moved directory still has children,
                 * Add rr_moved into pending_files to show
                 */
-               if (iso9660->rr_moved->subdirs)
+               if (iso9660->rr_moved->subdirs) {
                        cache_add_entry(iso9660, iso9660->rr_moved);
-               else {
+                       /* If entries which have "RE" extension are still
+                        * remaining(this case is unlikely except ISO image
+                        * is broken), the entries won't be exposed. */
+                       while ((file = heap_get_entry(&(iso9660->re_dirs))) != NULL)
+                               cache_add_entry(iso9660, file);
+               } else {
                        iso9660->rr_moved->parent->subdirs--;
                        release_file(iso9660, iso9660->rr_moved);
                }
+       } else {
+               /*
+                * In case ISO image is broken. If the name of rr_moved
+                * directory has been changed by damage, subdirectories
+                * of rr_moved entry won't be exposed.
+                */
+               while ((file = heap_get_entry(&(iso9660->re_dirs))) != NULL)
+                       cache_add_entry(iso9660, file);
        }
 
        return (ARCHIVE_OK);
@@ -2663,6 +2676,8 @@ cache_get_entry(struct iso9660 *iso9660)
        if ((file = iso9660->cache_files.first) != NULL) {
                iso9660->cache_files.first = file->next;
                file->refcount--;
+               if (iso9660->cache_files.first == NULL)
+                       iso9660->cache_files.last = &(iso9660->cache_files.first);
        }
        return (file);
 }
index eeae00b03a88eecb8d0cc7ec09122f7965bafd8a..828762ba10db848d5ad45f51d51bad181de381d8 100644 (file)
@@ -715,9 +715,11 @@ int
 tree_current_is_physical_link(struct tree *t)
 {
 #if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(IO_REPARSE_TAG_SYMLINK)
        if (t->findData)
                return ((t->findData->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
                                && (t->findData->dwReserved0 == IO_REPARSE_TAG_SYMLINK));
+#endif
        return (0);
 #else
        const struct stat *st = tree_current_lstat(t);