]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Additional fix to issue 168 because the change of r3642 was not sufficient.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sat, 27 Aug 2011 16:31:33 +0000 (12:31 -0400)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sat, 27 Aug 2011 16:31:33 +0000 (12:31 -0400)
  - Make sure "CL" entry appear after its "RE" entry which the "CL" entry
    should be connected with.
  - Give consideration to the case that the top level "RE" entry has already
    been exposed outside before its tree.

SVN-Revision: 3647

libarchive/archive_read_support_format_iso9660.c

index 0d7f76201dfa1683d0c83e25d8c27b161fc11672..e57c97418ff621762740f689f9347450c9da2da4 100644 (file)
@@ -1934,8 +1934,11 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
                        file->re_descendant = 1;
                if (file->cl_offset != 0) {
                        parent->subdirs++;
-                       /* To be appeared before other dirs. */
-                       file->offset = file->number = file->cl_offset;
+                       /* Overwrite an offset and a number of this "CL" entry
+                        * to appear before other dirs. "+1" to those is to
+                        * make sure to appear after "RE" entry which this
+                        * "CL" entry should be connected with. */
+                       file->offset = file->number = file->cl_offset + 1;
                }
        }
 
@@ -2718,13 +2721,16 @@ next_cache_entry(struct archive_read *a, struct iso9660 *iso9660,
                                continue;
                        } else if (file->re_descendant) {
                                /*
-                                * Do not expose this at this time
-                                * because we have not gotten its full-path
-                                * name yet.
+                                * If the top level "RE" entry of this entry
+                                * is not exposed, we, accordingly, should not
+                                * expose this entry at this time because
+                                * we cannot make its proper full-path name.
                                 */
-                               if (rede_add_entry(file) < 0)
-                                       goto fatal_rr;
-                               continue;
+                               if (rede_add_entry(file) == 0)
+                                       continue;
+                               /* Otherwise we can expose this entry because
+                                * it seems its top level "RE" has already been
+                                * exposed. */
                        }
                }
                break;