From 89330b89d86ae6cfb5143b0061963b50b04fd2bf Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 29 Sep 2017 01:07:28 +0800 Subject: [PATCH] Clone attributes to new tmpfs mountpoint --- jni/daemon/bootstages.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jni/daemon/bootstages.c b/jni/daemon/bootstages.c index 2084c41e5..7bfc40496 100644 --- a/jni/daemon/bootstages.c +++ b/jni/daemon/bootstages.c @@ -277,8 +277,16 @@ static void clone_skeleton(struct node_entry *node) { closedir(dir); if (node->status & IS_SKEL) { + struct stat s; + char *con; + xstat(full_path, &s); + getfilecon(full_path, &con); LOGI("tmpfs: %s\n", full_path); mount("tmpfs", full_path, "tmpfs", 0, NULL); + chmod(full_path, s.st_mode & 0777); + chown(full_path, s.st_uid, s.st_gid); + setfilecon(full_path, con); + free(con); } vec_for_each(node->children, child) {