From 658a944a6f77a58bd5f50d24b703ad6c118b1071 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sun, 1 Oct 2023 04:33:11 -0500 Subject: [PATCH] With tar -h, any file can be a hardlink. --- toys/posix/tar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toys/posix/tar.c b/toys/posix/tar.c index 01578a5c..35554d7c 100644 --- a/toys/posix/tar.c +++ b/toys/posix/tar.c @@ -344,7 +344,7 @@ static int add_to_tar(struct dirtree *node) // Are there hardlinks to a non-directory entry? lnk = 0; - if (st->st_nlink>1 && !S_ISDIR(st->st_mode)) { + if ((st->st_nlink>1 || FLAG(h)) && !S_ISDIR(st->st_mode)) { // Have we seen this dev&ino before? for (i = 0; i