git: aac389a34773 - main - makefs: handle mtree contents= in zfs

From: Brooks Davis <brooks_at_FreeBSD.org>
Date: Thu, 12 Jan 2023 18:20:12 UTC
The branch main has been updated by brooks:

URL: https://cgit.FreeBSD.org/src/commit/?id=aac389a347733b5fa2bf4df3dcb2d39b2f739d61

commit aac389a347733b5fa2bf4df3dcb2d39b2f739d61
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-01-12 18:18:24 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-01-12 18:18:24 +0000

    makefs: handle mtree contents= in zfs
    
    When a source path is provided use it rather than constructing one.
    
    Reviewed by:    markj
    Differential Revision:  https://reviews.freebsd.org/D38027
---
 usr.sbin/makefs/zfs/fs.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/usr.sbin/makefs/zfs/fs.c b/usr.sbin/makefs/zfs/fs.c
index ecade55db52c..b9cc860c2e29 100644
--- a/usr.sbin/makefs/zfs/fs.c
+++ b/usr.sbin/makefs/zfs/fs.c
@@ -255,7 +255,13 @@ static void
 fs_populate_path(const fsnode *cur, struct fs_populate_arg *arg,
     char *path, size_t sz, int *dirfdp)
 {
-	if (cur->root == NULL) {
+	if (cur->contents != NULL) {
+		size_t n;
+
+		*dirfdp = AT_FDCWD;
+		n = strlcpy(path, cur->contents, sz);
+		assert(n < sz);
+	} else if (cur->root == NULL) {
 		size_t n;
 
 		*dirfdp = SLIST_FIRST(&arg->dirs)->dirfd;