summaryrefslogtreecommitdiffstats
path: root/usr.bin/cpio
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2008-06-26 15:46:01 +0000
committerkientzle <kientzle@FreeBSD.org>2008-06-26 15:46:01 +0000
commitfce7b49c08cc40b6605935557f08c18c528b1de7 (patch)
tree6623091f90b7ed2811bfbd2fcd64685ccba86eac /usr.bin/cpio
parented2c19947c0fe3e8fb2c15a829d3946d0eeb7c18 (diff)
downloadFreeBSD-src-fce7b49c08cc40b6605935557f08c18c528b1de7.zip
FreeBSD-src-fce7b49c08cc40b6605935557f08c18c528b1de7.tar.gz
As reported by Alexey Shuvaev, -dumpl overwrote files after
linking them, with predictably bad results.
Diffstat (limited to 'usr.bin/cpio')
-rw-r--r--usr.bin/cpio/cpio.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/cpio/cpio.c b/usr.bin/cpio/cpio.c
index 79fdf9f..249f5ce 100644
--- a/usr.bin/cpio/cpio.c
+++ b/usr.bin/cpio/cpio.c
@@ -546,6 +546,8 @@ 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);
+ /* This is a straight link that carries no data. */
+ archive_entry_set_size(t, 0);
r = archive_write_header(cpio->archive, t);
archive_entry_free(t);
if (r != ARCHIVE_OK)
OpenPOWER on IntegriCloud