Blame SOURCES/e2fsprogs-1.45.6-create_inode-set-xattrs-to-the-root-directory-as-wel.patch

e427d2
From ade5263a516e4081abc14f63a73a5e0a96bb3f71 Mon Sep 17 00:00:00 2001
e427d2
From: Antoine Tenart <antoine.tenart@bootlin.com>
e427d2
Date: Fri, 17 Jul 2020 12:08:46 +0200
e427d2
Subject: [PATCH 13/46] create_inode: set xattrs to the root directory as well
e427d2
Content-Type: text/plain
e427d2
e427d2
populate_fs do copy the xattrs for all files and directories, but the
e427d2
root directory is skipped and as a result its extended attributes aren't
e427d2
set. This is an issue when using mkfs to build a full system image that
e427d2
can be used with SElinux in enforcing mode without making any runtime
e427d2
fix at first boot.
e427d2
e427d2
This patch adds logic to set the root directory's extended attributes.
e427d2
e427d2
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
e427d2
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
e427d2
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e427d2
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
e427d2
---
e427d2
 misc/create_inode.c | 8 ++++++++
e427d2
 1 file changed, 8 insertions(+)
e427d2
e427d2
diff --git a/misc/create_inode.c b/misc/create_inode.c
e427d2
index 837f3875..6f8487b9 100644
e427d2
--- a/misc/create_inode.c
e427d2
+++ b/misc/create_inode.c
e427d2
@@ -1050,9 +1050,17 @@ errcode_t populate_fs2(ext2_filsys fs, ext2_ino_t parent_ino,
e427d2
 	file_info.path_max_len = 255;
e427d2
 	file_info.path = calloc(file_info.path_max_len, 1);
e427d2
 
e427d2
+	retval = set_inode_xattr(fs, root, source_dir);
e427d2
+	if (retval) {
e427d2
+		com_err(__func__, retval,
e427d2
+			_("while copying xattrs on root directory"));
e427d2
+		goto out;
e427d2
+	}
e427d2
+
e427d2
 	retval = __populate_fs(fs, parent_ino, source_dir, root, &hdlinks,
e427d2
 			       &file_info, fs_callbacks);
e427d2
 
e427d2
+out:
e427d2
 	free(file_info.path);
e427d2
 	free(hdlinks.hdl);
e427d2
 	return retval;
e427d2
-- 
e427d2
2.35.1
e427d2