Commit baae1fc8 authored by topjohnwu's avatar topjohnwu

Modernize selinux stub

parent 2ab999f4
......@@ -13,14 +13,14 @@
// Stub implementations
static void v_s(char *) {}
static void v_s(char *s) { delete[] s; }
static int i_s(const char *) { return 0; }
static int i_ss(const char *, const char *) { return 0; }
static int i_ssp(const char *, char ** sp) {
*sp = (char *) xcalloc(1, 1);
*sp = new char[1]();
return 0;
}
......@@ -35,7 +35,7 @@ int (*lsetfilecon)(const char *, const char *) = i_ss;
void dload_selinux() {
void *handle = dlopen("libselinux.so", RTLD_LAZY);
if (handle == NULL)
if (handle == nullptr)
return;
*(void **) &freecon = dlsym(handle, "freecon");
*(void **) &setcon = dlsym(handle, "setcon");
......@@ -119,4 +119,4 @@ void restorecon() {
fd = xopen(DATABIN, O_RDONLY | O_CLOEXEC);
restore_magiskcon(fd);
close(fd);
}
\ No newline at end of file
}
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