summaryrefslogtreecommitdiff
path: root/cpio
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@gmail.com>2008-06-30 18:42:49 -0400
committerTim Kientzle <kientzle@gmail.com>2008-06-30 18:42:49 -0400
commitfd950989e54fd628ffe1c82fe4672e377e6bcb8f (patch)
tree2ed5bdff27c788b4467bda1990eb78352ed3f252 /cpio
parent71362fca17b40dbf32fb8bc3a3dc4ff539c360de (diff)
downloadlibarchive-fd950989e54fd628ffe1c82fe4672e377e6bcb8f.tar.gz
Don't try to hardlink dirs for -pl; this always fails
and generated an annoying warning for every directory. SVN-Revision: 145
Diffstat (limited to 'cpio')
-rw-r--r--cpio/cpio.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/cpio/cpio.c b/cpio/cpio.c
index a92cd3e8..515e9921 100644
--- a/cpio/cpio.c
+++ b/cpio/cpio.c
@@ -535,16 +535,23 @@ entry_to_archive(struct cpio *cpio, struct archive_entry *entry)
fprintf(stderr,"%s", destpath);
/*
- * Obviously, this only gets invoked in pass mode.
+ * Obviously, this only gets invoked in pass mode, since
+ * option_link is nonsense otherwise. Note that we can't
+ * hardlink dirs, and that if a link operation fails (because
+ * of cross-device restrictions), we'll fall back to copy mode
+ * for that entry.
*/
- if (cpio->option_link) {
+ if (cpio->option_link
+ && archive_entry_filetype(entry) != AE_IFDIR)
+ {
struct archive_entry *t;
/* Save the original entry in case we need it later. */
t = archive_entry_clone(entry);
if (t == NULL)
cpio_errc(1, ENOMEM, "Can't create link");
/* Note: link(2) doesn't create parent directories,
- * so we use archive_write_header() instead. */
+ * so we use archive_write_header() instead as a
+ * convenience. */
archive_entry_set_hardlink(t, srcpath);
archive_entry_set_size(t, 0);
r = archive_write_header(cpio->archive, t);