mirror of
https://gitee.com/openharmony/startup_init
synced 2024-11-27 10:20:46 +00:00
cmds: mkdir: restore SELinux security contexts only if the folder is newly created
Init scans pre-init existed folders and each new created folder. So don't do duplicated jobs. Issue: https://gitee.com/openharmony/startup_init/issues/I8QSAL Signed-off-by: Changbin Du <changbin.du@huawei.com>
This commit is contained in:
parent
aea671b2b7
commit
e8a1aad901
@ -350,7 +350,13 @@ static void DoMkDir(const struct CmdArgs *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
PluginExecCmdByName("restoreContentRecurse", ctx->argv[0]);
|
||||
/*
|
||||
* Skip restoring default SELinux security contexts if the the folder already
|
||||
* existed and its under /dev. These files will be proceed by loadSelinuxPolicy.
|
||||
*/
|
||||
if (errno != EEXIST || strncmp(ctx->argv[0], "/dev", strlen("/dev")) != 0) {
|
||||
PluginExecCmdByName("restoreContentRecurse", ctx->argv[0]);
|
||||
}
|
||||
|
||||
if (ctx->argc <= 1) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user