]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Do not process sum if a file is not a regular file.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Fri, 18 Mar 2011 19:58:06 +0000 (15:58 -0400)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Fri, 18 Mar 2011 19:58:06 +0000 (15:58 -0400)
Fix r3028.

SVN-Revision: 3030

libarchive/archive_write_set_format_mtree.c

index c014f8259678afb66458fe41c2e3a40f07c2d4ea..f10afe3071cf6e83ea4e63c23797b942b2e198bf 100644 (file)
@@ -966,7 +966,8 @@ write_entry(struct archive_write *a, struct mtree_entry *me)
        }
 
        /* Write a bunch of sum. */
-       sum_write(mtree, str, me);
+       if (me->filetype == AE_IFREG)
+               sum_write(mtree, str, me);
 
        archive_strcat(str, "\n");
        if (mtree->indent)
@@ -1012,7 +1013,8 @@ archive_write_mtree_finish_entry(struct archive_write *a)
                return (ARCHIVE_OK);
        mtree->mtree_entry = NULL;
 
-       sum_final(mtree, me);
+       if (me->filetype == AE_IFREG)
+               sum_final(mtree, me);
 
        if (mtree->set.output) {
                if (!mtree->dironly) {
@@ -1072,7 +1074,8 @@ archive_write_mtree_data(struct archive_write *a, const void *buff, size_t n)
        if (mtree->mtree_entry == NULL)
                return (n);
 
-       sum_update(mtree, buff, n);
+       if (mtree->mtree_entry->filetype == AE_IFREG)
+               sum_update(mtree, buff, n);
 
        return (n);
 }