am f310f6c5: Merge "Remove HAVE_SELINUX guards"
* commit 'f310f6c5725f9f9985ee30e744a2b65fed9d572e':
Remove HAVE_SELINUX guards
diff --git a/ext4_utils/Android.mk b/ext4_utils/Android.mk
index 99145a4..f9b571e 100644
--- a/ext4_utils/Android.mk
+++ b/ext4_utils/Android.mk
@@ -21,13 +21,12 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libext4_utils_src_files)
LOCAL_MODULE := libext4_utils_host
-LOCAL_C_INCLUDES += external/zlib
-LOCAL_STATIC_LIBRARIES += libsparse_host
-ifeq ($(HAVE_SELINUX), true)
- LOCAL_C_INCLUDES += external/libselinux/include
+LOCAL_STATIC_LIBRARIES := \
+ libsparse_host \
+ libz
+ifneq ($(HOST_OS),windows)
LOCAL_STATIC_LIBRARIES += libselinux
- LOCAL_CFLAGS += -DHAVE_SELINUX
-endif # HAVE_SELINUX
+endif
include $(BUILD_HOST_STATIC_LIBRARY)
@@ -41,11 +40,7 @@
ifeq ($(HOST_OS),windows)
LOCAL_LDLIBS += -lws2_32
else
- ifeq ($(HAVE_SELINUX), true)
- LOCAL_C_INCLUDES += external/libselinux/include
- LOCAL_STATIC_LIBRARIES += libselinux
- LOCAL_CFLAGS += -DHAVE_SELINUX
- endif # HAVE_SELINUX
+ LOCAL_STATIC_LIBRARIES += libselinux
endif
include $(BUILD_HOST_EXECUTABLE)
@@ -59,41 +54,29 @@
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libext4_utils_src_files)
LOCAL_MODULE := libext4_utils
-LOCAL_C_INCLUDES += external/zlib
LOCAL_SHARED_LIBRARIES := \
+ libselinux \
libsparse \
libz
-ifeq ($(HAVE_SELINUX), true)
- LOCAL_C_INCLUDES += external/libselinux/include
- LOCAL_SHARED_LIBRARIES += libselinux
- LOCAL_CFLAGS += -DHAVE_SELINUX
-endif # HAVE_SELINUX
include $(BUILD_SHARED_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(libext4_utils_src_files)
LOCAL_MODULE := libext4_utils_static
-LOCAL_C_INCLUDES += external/zlib
LOCAL_STATIC_LIBRARIES += \
+ libselinux \
libsparse_static
-ifeq ($(HAVE_SELINUX), true)
- LOCAL_C_INCLUDES += external/libselinux/include
- LOCAL_STATIC_LIBRARIES += libselinux
- LOCAL_CFLAGS += -DHAVE_SELINUX
-endif # HAVE_SELINUX
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := make_ext4fs_main.c
LOCAL_MODULE := make_ext4fs
-LOCAL_SHARED_LIBRARIES += libext4_utils libz
-ifeq ($(HAVE_SELINUX), true)
- LOCAL_C_INCLUDES += external/libselinux/include
- LOCAL_SHARED_LIBRARIES += libselinux
- LOCAL_CFLAGS += -DHAVE_SELINUX
-endif # HAVE_SELINUX
+LOCAL_SHARED_LIBRARIES := \
+ libext4_utils \
+ libselinux \
+ libz
include $(BUILD_EXECUTABLE)
@@ -102,13 +85,9 @@
LOCAL_MODULE := ext2simg
LOCAL_SHARED_LIBRARIES += \
libext4_utils \
+ libselinux \
libsparse \
libz
-ifeq ($(HAVE_SELINUX), true)
- LOCAL_C_INCLUDES += external/libselinux/include
- LOCAL_SHARED_LIBRARIES += libselinux
- LOCAL_CFLAGS += -DHAVE_SELINUX
-endif # HAVE_SELINUX
include $(BUILD_EXECUTABLE)
@@ -117,13 +96,9 @@
LOCAL_MODULE := ext2simg
LOCAL_STATIC_LIBRARIES += \
libext4_utils_host \
+ libselinux \
libsparse_host \
libz
-ifeq ($(HAVE_SELINUX), true)
- LOCAL_C_INCLUDES += external/libselinux/include
- LOCAL_STATIC_LIBRARIES += libselinux
- LOCAL_CFLAGS += -DHAVE_SELINUX
-endif # HAVE_SELINUX
include $(BUILD_HOST_EXECUTABLE)
diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c
index 662da6d..ca81398 100644
--- a/ext4_utils/make_ext4fs.c
+++ b/ext4_utils/make_ext4fs.c
@@ -157,15 +157,18 @@
error("can't set android permissions - built without android support");
#endif
}
-#ifdef HAVE_SELINUX
+#ifndef USE_MINGW
if (sehnd) {
char *sepath = NULL;
asprintf(&sepath, "/%s", dentries[i].path);
if (selabel_lookup(sehnd, &dentries[i].secon, sepath, stat.st_mode) < 0) {
error("cannot lookup security context for %s", sepath);
}
+#if 0
+ // TODO make this a debug flag
if (dentries[i].secon)
printf("Labeling %s as %s\n", sepath, dentries[i].secon);
+#endif
free(sepath);
}
#endif
@@ -428,7 +431,7 @@
root_mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
inode_set_permissions(root_inode_num, root_mode, 0, 0, 0);
-#ifdef HAVE_SELINUX
+#ifndef USE_MINGW
if (sehnd) {
char *sepath = NULL;
char *secontext = NULL;
diff --git a/ext4_utils/make_ext4fs.h b/ext4_utils/make_ext4fs.h
index bfc008a..577157a 100644
--- a/ext4_utils/make_ext4fs.h
+++ b/ext4_utils/make_ext4fs.h
@@ -24,7 +24,7 @@
extern "C" {
#endif
-#ifdef HAVE_SELINUX
+#ifndef USE_MINGW
#include <selinux/selinux.h>
#include <selinux/label.h>
#else
diff --git a/ext4_utils/make_ext4fs_main.c b/ext4_utils/make_ext4fs_main.c
index f7beeb5..c54618d 100644
--- a/ext4_utils/make_ext4fs_main.c
+++ b/ext4_utils/make_ext4fs_main.c
@@ -62,7 +62,7 @@
int fd;
int exitcode;
struct selabel_handle *sehnd = NULL;
-#ifdef HAVE_SELINUX
+#ifndef USE_MINGW
struct selinux_opt seopts[] = { { SELABEL_OPT_PATH, "" } };
#endif
@@ -121,7 +121,7 @@
init_itabs = 1;
break;
case 'S':
-#ifdef HAVE_SELINUX
+#ifndef USE_MINGW
seopts[0].value = optarg;
sehnd = selabel_open(SELABEL_CTX_FILE, seopts, 1);
if (!sehnd) {
@@ -129,7 +129,7 @@
exit(EXIT_FAILURE);
}
#endif
- break;
+ break;
default: /* '?' */
usage(argv[0]);
exit(EXIT_FAILURE);