From: Michihiro NAKAJIMA Date: Thu, 14 Jul 2011 13:39:47 +0000 (-0400) Subject: In iso9660 writer and xar writer, always overwrite the existing file in the file... X-Git-Tag: v3.0.0a~244 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df0f7eb14dcac8a0626c74ce669273ddc5449997;p=thirdparty%2Flibarchive.git In iso9660 writer and xar writer, always overwrite the existing file in the file tree which file has the same name; it is better that front-end applications such as tar decide how they handle that case. SVN-Revision: 3480 --- diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c index 62c039d22..6bd530e1e 100644 --- a/libarchive/archive_write_set_format_iso9660.c +++ b/libarchive/archive_write_set_format_iso9660.c @@ -5676,13 +5676,12 @@ same_entry: *isoentpp = NULL; return (ARCHIVE_FAILED); } - if (archive_entry_mtime(f1->entry) < - archive_entry_mtime(f2->entry) || np->virtual) { - /* Swap file entries. */ - np->file = f2; - isoent->file = f1; - np->virtual = 0; - } + + /* Swap file entries. */ + np->file = f2; + isoent->file = f1; + np->virtual = 0; + _isoent_free(isoent); *isoentpp = np; return (ARCHIVE_OK); diff --git a/libarchive/archive_write_set_format_xar.c b/libarchive/archive_write_set_format_xar.c index 53489e1c3..6e0567d2a 100644 --- a/libarchive/archive_write_set_format_xar.c +++ b/libarchive/archive_write_set_format_xar.c @@ -2196,6 +2196,7 @@ file_tree(struct archive_write *a, struct file **filepp) #endif struct xar *xar = (struct xar *)a->format_data; struct file *dent, *file, *np; + struct archive_entry *ent; const char *fn, *p; int l; @@ -2348,16 +2349,13 @@ same_entry: *filepp = NULL; return (ARCHIVE_FAILED); } - if (archive_entry_mtime(np->entry) < - archive_entry_mtime(file->entry) || np->virtual) { - /* Swap files. */ - struct archive_entry *ent; - ent = np->entry; - np->entry = file->entry; - file->entry = ent; - np->virtual = 0; - } + /* Swap files. */ + ent = np->entry; + np->entry = file->entry; + file->entry = ent; + np->virtual = 0; + file_free(file); *filepp = np; return (ARCHIVE_OK);