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

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