Commit bd4e5bfc authored by topjohnwu's avatar topjohnwu

Some minor optmizations

parent 621fd0ee
......@@ -28,9 +28,7 @@ int main(int argc, char *argv[]) {
cmdline_logging();
init_argv0(argc, argv);
if (strcmp(basename(argv[0]), "magisk.bin") == 0 ||
(strcmp(basename(argv[0]), "magisk") == 0
&& argc > 1 && argv[1][0] != '-')) {
if ((strcmp(basename(argv[0]), "magisk") == 0 && argc > 1 && argv[1][0] != '-')) {
--argc;
++argv;
}
......
......@@ -79,18 +79,16 @@ void selinux_builtin_impl() {
getfilecon = __getfilecon;
lgetfilecon = __lgetfilecon;
setfilecon = __setfilecon;
setfilecon = __lsetfilecon;
lsetfilecon = __lsetfilecon;
}
void dload_selinux() {
void *handle = dlopen("libselinux.so", RTLD_LAZY);
if (handle == nullptr)
if (access("/system/lib/libselinux.so", F_OK))
return;
/* We only use dlopen to know whether libselinux.so exists.
/* We only check whether libselinux.so exists but don't dlopen.
* For some reason calling symbols returned from dlsym
* will result to SEGV_ACCERR on some devices.
* Always use builtin implementations for SELinux stuffs. */
dlclose(handle);
selinux_builtin_impl();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment