summaryrefslogtreecommitdiffstats
path: root/usr.bin/cpio
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2008-07-05 05:16:23 +0000
committerkientzle <kientzle@FreeBSD.org>2008-07-05 05:16:23 +0000
commitdabdf719621b303af305abd23391fbecd0d5df42 (patch)
treea116cb2f105a039a4e6f65abc213cdd8e5ad4e84 /usr.bin/cpio
parente9f8012461c70ba938600758f9d546bc6a43d220 (diff)
downloadFreeBSD-src-dabdf719621b303af305abd23391fbecd0d5df42.zip
FreeBSD-src-dabdf719621b303af305abd23391fbecd0d5df42.tar.gz
In -pl mode, only hardlink regular files. I need to test
other implementations, but it's clear that dirs and symlinks, at least, shouldn't be hardlinked.
Diffstat (limited to 'usr.bin/cpio')
-rw-r--r--usr.bin/cpio/cpio.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/cpio/cpio.c b/usr.bin/cpio/cpio.c
index c5d86d7..f2c49ba 100644
--- a/usr.bin/cpio/cpio.c
+++ b/usr.bin/cpio/cpio.c
@@ -535,14 +535,16 @@ entry_to_archive(struct cpio *cpio, struct archive_entry *entry)
fprintf(stderr,"%s", destpath);
/*
- * 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.
+ * Option_link only makes sense in pass mode and for
+ * regular files. Also note: if a link operation fails
+ * because of cross-device restrictions, we'll fall back
+ * to copy mode for that entry.
+ *
+ * TODO: Test other cpio implementations to see if they
+ * hard-link anything other than regular files here.
*/
if (cpio->option_link
- && archive_entry_filetype(entry) != AE_IFDIR)
+ && archive_entry_filetype(entry) == AE_IFREG)
{
struct archive_entry *t;
/* Save the original entry in case we need it later. */
OpenPOWER on IntegriCloud