Merge "Replace security_context_t type" am: 8bf8b19e84
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1827241 Change-Id: Ib903b986d77efb785d4e3fa1509f0146b66f3609
This commit is contained in:
@@ -1142,14 +1142,14 @@ static void isolateAppDataPerPackage(int userId, std::string_view package_name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Relabel directory
|
// Relabel directory
|
||||||
static void relabelDir(const char* path, security_context_t context, fail_fn_t fail_fn) {
|
static void relabelDir(const char* path, const char* context, fail_fn_t fail_fn) {
|
||||||
if (setfilecon(path, context) != 0) {
|
if (setfilecon(path, context) != 0) {
|
||||||
fail_fn(CREATE_ERROR("Failed to setfilecon %s %s", path, strerror(errno)));
|
fail_fn(CREATE_ERROR("Failed to setfilecon %s %s", path, strerror(errno)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Relabel all directories under a path non-recursively.
|
// Relabel all directories under a path non-recursively.
|
||||||
static void relabelAllDirs(const char* path, security_context_t context, fail_fn_t fail_fn) {
|
static void relabelAllDirs(const char* path, const char* context, fail_fn_t fail_fn) {
|
||||||
DIR* dir = opendir(path);
|
DIR* dir = opendir(path);
|
||||||
if (dir == nullptr) {
|
if (dir == nullptr) {
|
||||||
fail_fn(CREATE_ERROR("Failed to opendir %s", path));
|
fail_fn(CREATE_ERROR("Failed to opendir %s", path));
|
||||||
@@ -1224,7 +1224,7 @@ static void isolateAppData(JNIEnv* env, const std::vector<std::string>& merged_d
|
|||||||
snprintf(internalDePath, PATH_MAX, "/data/user_de");
|
snprintf(internalDePath, PATH_MAX, "/data/user_de");
|
||||||
snprintf(externalPrivateMountPath, PATH_MAX, "/mnt/expand");
|
snprintf(externalPrivateMountPath, PATH_MAX, "/mnt/expand");
|
||||||
|
|
||||||
security_context_t dataDataContext = nullptr;
|
char* dataDataContext = nullptr;
|
||||||
if (getfilecon(internalDePath, &dataDataContext) < 0) {
|
if (getfilecon(internalDePath, &dataDataContext) < 0) {
|
||||||
fail_fn(CREATE_ERROR("Unable to getfilecon on %s %s", internalDePath,
|
fail_fn(CREATE_ERROR("Unable to getfilecon on %s %s", internalDePath,
|
||||||
strerror(errno)));
|
strerror(errno)));
|
||||||
|
|||||||
Reference in New Issue
Block a user