aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2012-10-16 10:47:27 -0700
committerChirayu Desai <cdesai@cyanogenmod.org>2013-03-17 16:37:00 +0530
commit34f330b6a3af78b88c069df7a3aa8b7fd4190883 (patch)
treecfa8d06dd49270601228362aa4ee660d0a07c470
parentedc87090bab7709a1a1ccd19c46ea68a55fcde9a (diff)
downloadbootable_recovery-34f330b6a3af78b88c069df7a3aa8b7fd4190883.zip
bootable_recovery-34f330b6a3af78b88c069df7a3aa8b7fd4190883.tar.gz
bootable_recovery-34f330b6a3af78b88c069df7a3aa8b7fd4190883.tar.bz2
Remove HAVE_SELINUX guards
Change-Id: Iddb0a977a8e809413defd4e7a9bb21311f5db862
-rw-r--r--Android.mk2
-rw-r--r--minzip/Android.mk8
-rw-r--r--minzip/DirUtil.c5
-rw-r--r--minzip/DirUtil.h4
-rw-r--r--minzip/Zip.c4
-rw-r--r--minzip/Zip.h4
-rw-r--r--recovery.c11
-rw-r--r--updater/Android.mk8
-rw-r--r--updater/install.c4
-rw-r--r--updater/updater.c4
-rw-r--r--updater/updater.h4
11 files changed, 17 insertions, 41 deletions
diff --git a/Android.mk b/Android.mk
index aed6805..f05887d 100644
--- a/Android.mk
+++ b/Android.mk
@@ -99,6 +99,8 @@ endif
LOCAL_STATIC_LIBRARIES += libminui libpixelflinger_static libpng libcutils
LOCAL_STATIC_LIBRARIES += libstdc++ libc
+LOCAL_STATIC_LIBRARIES += libselinux
+
LOCAL_C_INCLUDES += system/extras/ext4_utils
include $(BUILD_EXECUTABLE)
diff --git a/minzip/Android.mk b/minzip/Android.mk
index 6c1d096..045f355 100644
--- a/minzip/Android.mk
+++ b/minzip/Android.mk
@@ -8,15 +8,11 @@ LOCAL_SRC_FILES := \
Inlines.c \
Zip.c
-LOCAL_C_INCLUDES += \
+LOCAL_C_INCLUDES := \
external/zlib \
external/safe-iop/include
-ifeq ($(HAVE_SELINUX),true)
-LOCAL_C_INCLUDES += external/libselinux/include
-LOCAL_STATIC_LIBRARIES += libselinux
-LOCAL_CFLAGS += -DHAVE_SELINUX
-endif
+LOCAL_STATIC_LIBRARIES := libselinux
LOCAL_MODULE := libminzip
diff --git a/minzip/DirUtil.c b/minzip/DirUtil.c
index 0d49b57..8dd5da1 100644
--- a/minzip/DirUtil.c
+++ b/minzip/DirUtil.c
@@ -145,24 +145,19 @@ dirCreateHierarchy(const char *path, int mode,
} else if (ds == DMISSING) {
int err;
-#ifdef HAVE_SELINUX
char *secontext = NULL;
if (sehnd) {
selabel_lookup(sehnd, &secontext, cpath, mode);
setfscreatecon(secontext);
}
-#endif
err = mkdir(cpath, mode);
-#ifdef HAVE_SELINUX
-
if (secontext) {
freecon(secontext);
setfscreatecon(NULL);
}
-#endif
if (err != 0) {
free(cpath);
diff --git a/minzip/DirUtil.h b/minzip/DirUtil.h
index f8be640..a5cfa76 100644
--- a/minzip/DirUtil.h
+++ b/minzip/DirUtil.h
@@ -24,12 +24,8 @@
extern "C" {
#endif
-#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
-#else
-struct selabel_handle;
-#endif
/* Like "mkdir -p", try to guarantee that all directories
* specified in path are present, creating as many directories
diff --git a/minzip/Zip.c b/minzip/Zip.c
index 54d5d55..c87f038 100644
--- a/minzip/Zip.c
+++ b/minzip/Zip.c
@@ -1115,23 +1115,19 @@ bool mzExtractRecursive(const ZipArchive *pArchive,
* Open the target for writing.
*/
-#ifdef HAVE_SELINUX
char *secontext = NULL;
if (sehnd) {
selabel_lookup(sehnd, &secontext, targetFile, UNZIP_FILEMODE);
setfscreatecon(secontext);
}
-#endif
int fd = creat(targetFile, UNZIP_FILEMODE);
-#ifdef HAVE_SELINUX
if (secontext) {
freecon(secontext);
setfscreatecon(NULL);
}
-#endif
if (fd < 0) {
LOGE("Can't create target file \"%s\": %s\n",
diff --git a/minzip/Zip.h b/minzip/Zip.h
index 4bb9ef6..c942828 100644
--- a/minzip/Zip.h
+++ b/minzip/Zip.h
@@ -18,12 +18,8 @@
extern "C" {
#endif
-#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
-#else
-struct selabel_handle;
-#endif
/*
* One entry in the Zip archive. Treat this as opaque -- use accessors below.
diff --git a/recovery.c b/recovery.c
index c70ee3a..9aa19ef 100644
--- a/recovery.c
+++ b/recovery.c
@@ -877,6 +877,17 @@ main(int argc, char **argv) {
}
}
+ struct selinux_opt seopts[] = {
+ { SELABEL_OPT_PATH, "/file_contexts" }
+ };
+
+ sehandle = selabel_open(SELABEL_CTX_FILE, seopts, 1);
+
+ if (!sehandle) {
+ fprintf(stderr, "Warning: No file_contexts\n");
+ // ui_print("Warning: No file_contexts\n");
+ }
+
LOGI("device_recovery_start()\n");
device_recovery_start();
diff --git a/updater/Android.mk b/updater/Android.mk
index 59e6391..51a7a05 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -28,19 +28,13 @@ LOCAL_STATIC_LIBRARIES += \
libz
endif
-ifeq ($(HAVE_SELINUX), true)
-LOCAL_C_INCLUDES += external/libselinux/include
-LOCAL_STATIC_LIBRARIES += libselinux
-LOCAL_CFLAGS += -DHAVE_SELINUX
-endif # HAVE_SELINUX
-
LOCAL_STATIC_LIBRARIES += libflashutils libmtdutils libmmcutils libbmlutils
-
LOCAL_STATIC_LIBRARIES += $(TARGET_RECOVERY_UPDATER_LIBS) $(TARGET_RECOVERY_UPDATER_EXTRA_LIBS)
LOCAL_STATIC_LIBRARIES += libapplypatch libedify libmtdutils libminzip libz
LOCAL_STATIC_LIBRARIES += libmincrypt libbz
LOCAL_STATIC_LIBRARIES += libminelf
LOCAL_STATIC_LIBRARIES += libcutils libstdc++ libc
+LOCAL_STATIC_LIBRARIES += libselinux
LOCAL_C_INCLUDES += $(LOCAL_PATH)/..
# Each library in TARGET_RECOVERY_UPDATER_LIBS should have a function
diff --git a/updater/install.c b/updater/install.c
index 379e927..c1e0a63 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -78,23 +78,19 @@ Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) {
goto done;
}
-#ifdef HAVE_SELINUX
char *secontext = NULL;
if (sehandle) {
selabel_lookup(sehandle, &secontext, mount_point, 0755);
setfscreatecon(secontext);
}
-#endif
mkdir(mount_point, 0755);
-#ifdef HAVE_SELINUX
if (secontext) {
freecon(secontext);
setfscreatecon(NULL);
}
-#endif
if (strcmp(partition_type, "MTD") == 0) {
mtd_scan_partitions();
diff --git a/updater/updater.c b/updater/updater.c
index 5f15808..bf665ca 100644
--- a/updater/updater.c
+++ b/updater/updater.c
@@ -105,7 +105,6 @@ int main(int argc, char** argv) {
return 6;
}
-#ifdef HAVE_SELINUX
struct selinux_opt seopts[] = {
{ SELABEL_OPT_PATH, "/file_contexts" }
};
@@ -114,9 +113,8 @@ int main(int argc, char** argv) {
if (!sehandle) {
fprintf(stderr, "Warning: No file_contexts\n");
- fprintf(cmd_pipe, "ui_print Warning: No file_contexts\n");
+ // fprintf(cmd_pipe, "ui_print Warning: No file_contexts\n");
}
-#endif
// Evaluate the parsed script.
diff --git a/updater/updater.h b/updater/updater.h
index a00872c..d2e9011 100644
--- a/updater/updater.h
+++ b/updater/updater.h
@@ -20,12 +20,8 @@
#include <stdio.h>
#include "minzip/Zip.h"
-#ifdef HAVE_SELINUX
#include <selinux/selinux.h>
#include <selinux/label.h>
-#else
-struct selabel_handle;
-#endif
typedef struct {
FILE* cmd_pipe;