Drop API 17 (Android 4.2) support

This commit is contained in:
topjohnwu
2019-10-19 03:11:54 -04:00
parent 935bd01f59
commit 9c27d691dd
6 changed files with 17 additions and 34 deletions

View File

@ -20,7 +20,7 @@
__BEGIN_DECLS
extern void (*freecon)(char *con);
#define freecon free
extern int (*setcon)(const char *con);
extern int (*getfilecon)(const char *path, char **con);
extern int (*lgetfilecon)(const char *path, char **con);
@ -32,7 +32,6 @@ void getfilecon_at(int dirfd, const char *name, char **con);
void setfilecon_at(int dirfd, const char *name, const char *con);
void selinux_builtin_impl();
void dload_selinux();
void restorecon();
void restore_rootcon();

View File

@ -38,10 +38,6 @@ static int stub(int, char **ctx) {
// Builtin implementation
static void __freecon(char *s) {
free(s);
}
static int __setcon(const char *ctx) {
int fd = open("/proc/self/attr/current", O_WRONLY | O_CLOEXEC);
if (fd < 0)
@ -114,7 +110,6 @@ static int __fsetfilecon(int fd, const char *ctx) {
// Function pointers
void (*freecon)(char *) = __freecon;
int (*setcon)(const char *) = stub;
int (*getfilecon)(const char *, char **) = stub;
int (*lgetfilecon)(const char *, char **) = stub;
@ -146,16 +141,6 @@ void selinux_builtin_impl() {
fsetfilecon = __fsetfilecon;
}
void dload_selinux() {
if (access("/system/lib/libselinux.so", F_OK))
return;
/* 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. */
selinux_builtin_impl();
}
static void restore_syscon(int dirfd) {
struct dirent *entry;
DIR *dir;