]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
When hardlinking files for -l by using archive_write_header(),
authorTim Kientzle <kientzle@gmail.com>
Thu, 26 Jun 2008 08:51:21 +0000 (04:51 -0400)
committerTim Kientzle <kientzle@gmail.com>
Thu, 26 Jun 2008 08:51:21 +0000 (04:51 -0400)
ensure that we're just doing a bare hardlink without any accompanying
data.  (Remember that cpio allows hardlinks to have data.)
Otherwise, -l creates a link and then opens the linked files
for overwrite, resulting in the files being erased.

SVN-Revision: 143

cpio/cpio.c

index 7b30062380cf93e00271363851eb31e6bad9c9ae..a92cd3e866bf5ae362926077582e9d451f70d904 100644 (file)
@@ -546,6 +546,7 @@ entry_to_archive(struct cpio *cpio, struct archive_entry *entry)
                /* Note: link(2) doesn't create parent directories,
                 * so we use archive_write_header() instead. */
                archive_entry_set_hardlink(t, srcpath);
+               archive_entry_set_size(t, 0);
                r = archive_write_header(cpio->archive, t);
                archive_entry_free(t);
                if (r != ARCHIVE_OK)