mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-27 20:15:29 +00:00
Some minor optmizations
This commit is contained in:
parent
621fd0ee29
commit
bd4e5bfc1a
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user