]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix writing of cpio archives containing hardlinks without file type 1387/head
authorGleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Fri, 29 May 2020 10:12:29 +0000 (13:12 +0300)
committerGleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
Fri, 29 May 2020 10:12:39 +0000 (13:12 +0300)
Fixes: https://github.com/libarchive/libarchive/issues/1386
libarchive/archive_write_set_format_cpio.c
libarchive/archive_write_set_format_cpio_newc.c

index 729f9c7755915febbb64e6d2c376c27d94b572d2..465e4ed284f946bbd47a376a0d8da35b047457e7 100644 (file)
@@ -250,7 +250,7 @@ archive_write_cpio_header(struct archive_write *a, struct archive_entry *entry)
        const char *path;
        size_t len;
 
-       if (archive_entry_filetype(entry) == 0) {
+       if (archive_entry_filetype(entry) == 0 && archive_entry_hardlink(entry) == NULL) {
                archive_set_error(&a->archive, -1, "Filetype required");
                return (ARCHIVE_FAILED);
        }
index 172fda62f0bb71d6fc0876c0f09441292e2e8644..f0f39809dad47112948d6cc20601ad471df2c72e 100644 (file)
@@ -190,7 +190,7 @@ archive_write_newc_header(struct archive_write *a, struct archive_entry *entry)
        const char *path;
        size_t len;
 
-       if (archive_entry_filetype(entry) == 0) {
+       if (archive_entry_filetype(entry) == 0 && archive_entry_hardlink(entry) == NULL) {
                archive_set_error(&a->archive, -1, "Filetype required");
                return (ARCHIVE_FAILED);
        }