mirror of
https://gitee.com/openharmony/distributeddatamgr_udmf
synced 2024-10-07 05:43:56 +00:00
utd 动态添加selinux 文件标签
Signed-off-by: genglingxia <genglingxia3@huawei.com>
This commit is contained in:
parent
a22c906250
commit
046278a99a
@ -35,7 +35,8 @@
|
||||
"kv_store",
|
||||
"napi",
|
||||
"samgr",
|
||||
"app_file_service"
|
||||
"app_file_service",
|
||||
"selinux_adapter"
|
||||
],
|
||||
"third_party": [
|
||||
"bounds_checking_function",
|
||||
|
@ -18,6 +18,9 @@
|
||||
#include "unistd.h"
|
||||
#include "error_code.h"
|
||||
#include "logger.h"
|
||||
#ifdef WITH_SELINUX
|
||||
#include <policycoreutils.h>
|
||||
#endif
|
||||
namespace OHOS {
|
||||
namespace UDMF {
|
||||
constexpr const char* UTD_CFG_FILE = "utd-adt.json";
|
||||
@ -102,7 +105,14 @@ bool CustomUtdStore::CreateDirectory(const std::string &path) const
|
||||
}
|
||||
} while (index != std::string::npos);
|
||||
|
||||
return access(path.c_str(), F_OK) == 0;
|
||||
if (access(path.c_str(), F_OK) == 0) {
|
||||
#ifdef WITH_SELINUX
|
||||
Restorecon(path.c_str());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
} // namespace UDMF
|
||||
} // namespace OHOS
|
@ -94,4 +94,9 @@ ohos_shared_library("udmf_client") {
|
||||
subsystem_name = "distributeddatamgr"
|
||||
|
||||
part_name = "udmf"
|
||||
|
||||
if (build_selinux) {
|
||||
cflags = [ "-DWITH_SELINUX" ]
|
||||
external_deps += [ "selinux_adapter:librestorecon" ]
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user