Set proper selinux context for /sbin re-link

This commit is contained in:
topjohnwu 2017-07-14 00:51:42 +08:00
parent e5b704eb32
commit e33a5eb307
2 changed files with 8 additions and 4 deletions

View File

@ -78,10 +78,14 @@ void relink_sbin() {
dir = xopendir("/sbin_orig");
while ((entry = xreaddir(dir))) {
snprintf(from, sizeof(from), "%s/%s", "/sbin_orig", entry->d_name);
snprintf(to, sizeof(to), "%s/%s", "/dev/sbin_bind", entry->d_name);
if (strcmp(entry->d_name, "..") == 0)
continue;
snprintf(from, sizeof(from), "/sbin_orig/%s", entry->d_name);
if (entry->d_type == DT_LNK)
xreadlink(from, from, sizeof(from));
snprintf(to, sizeof(to), "/dev/sbin_bind/%s", entry->d_name);
symlink(from, to);
lsetfilecon(to, "u:object_r:system_file:s0");
lsetfilecon(to, "u:object_r:rootfs:s0");
}
closedir(dir);

@ -1 +1 @@
Subproject commit 4c7e081e158b1d6a56a76b98f61d880f3d8a994d
Subproject commit c1c6f55f8f51cd24b5f926059e32d4a70a422430