From: Tim Kientzle Date: Thu, 26 Jun 2008 08:51:21 +0000 (-0400) Subject: When hardlinking files for -l by using archive_write_header(), X-Git-Tag: v2.6.0~149 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bda5744a404eccf4c57d00227d717cc996bd4f9;p=thirdparty%2Flibarchive.git When hardlinking files for -l by using archive_write_header(), 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 --- diff --git a/cpio/cpio.c b/cpio/cpio.c index 7b3006238..a92cd3e86 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -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)