Fix files context
This commit is contained in:
parent
4c3f8d95db
commit
4768d6cba4
|
|
@ -438,15 +438,14 @@ public class ConfigFileManager {
|
||||||
static Path resolveModuleDir(String packageName, String dir, int userId, int uid) throws IOException {
|
static Path resolveModuleDir(String packageName, String dir, int userId, int uid) throws IOException {
|
||||||
var path = modulePath.resolve(String.valueOf(userId)).resolve(packageName).resolve(dir).normalize();
|
var path = modulePath.resolve(String.valueOf(userId)).resolve(packageName).resolve(dir).normalize();
|
||||||
if (uid != -1) {
|
if (uid != -1) {
|
||||||
if (!path.toFile().mkdirs()) {
|
if (path.toFile().mkdirs()) {
|
||||||
throw new IOException("Can not create " + dir + " for " + packageName);
|
try {
|
||||||
}
|
SELinux.setFileContext(path.toString(), "u:object_r:magisk_file:s0");
|
||||||
SELinux.setFileContext(path.toString(), "u:object_r::s0");
|
Os.chown(path.toString(), uid, uid);
|
||||||
try {
|
Os.chmod(path.toString(), 0755);
|
||||||
Os.chown(path.toString(), uid, uid);
|
} catch (ErrnoException e) {
|
||||||
Os.chmod(path.toString(), 0755);
|
throw new IOException(e);
|
||||||
} catch (ErrnoException e) {
|
}
|
||||||
throw new IOException(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue