summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Root <kroot@android.com>2012-10-17 12:58:58 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-10-17 12:58:58 -0700
commitaf41b37f0088417f98261c24647f195ecd4999fc (patch)
treea3696d2565d84854a85f2345058ae16adbfede3b
parent4ff85ad26acab3f4bbab6195c5e092999164f7d8 (diff)
parent7176b213480e87bc303073ccc553fdc824198355 (diff)
downloadextras-af41b37f0088417f98261c24647f195ecd4999fc.tar.gz
am 7176b213: Merge "Add automatic file_contexts handle to make_ext4fs."
* commit '7176b213480e87bc303073ccc553fdc824198355': Add automatic file_contexts handle to make_ext4fs.
-rw-r--r--ext4_utils/Android.mk1
-rw-r--r--ext4_utils/make_ext4fs.h1
-rw-r--r--ext4_utils/make_ext4fs_main.c12
3 files changed, 14 insertions, 0 deletions
diff --git a/ext4_utils/Android.mk b/ext4_utils/Android.mk
index f9b571e2..1fef7353 100644
--- a/ext4_utils/Android.mk
+++ b/ext4_utils/Android.mk
@@ -41,6 +41,7 @@ ifeq ($(HOST_OS),windows)
LOCAL_LDLIBS += -lws2_32
else
LOCAL_STATIC_LIBRARIES += libselinux
+ LOCAL_CFLAGS := -DHOST
endif
include $(BUILD_HOST_EXECUTABLE)
diff --git a/ext4_utils/make_ext4fs.h b/ext4_utils/make_ext4fs.h
index 577157ac..e80e6367 100644
--- a/ext4_utils/make_ext4fs.h
+++ b/ext4_utils/make_ext4fs.h
@@ -27,6 +27,7 @@ extern "C" {
#ifndef USE_MINGW
#include <selinux/selinux.h>
#include <selinux/label.h>
+#include <selinux/android.h>
#else
struct selabel_handle;
#endif
diff --git a/ext4_utils/make_ext4fs_main.c b/ext4_utils/make_ext4fs_main.c
index c54618db..000b857d 100644
--- a/ext4_utils/make_ext4fs_main.c
+++ b/ext4_utils/make_ext4fs_main.c
@@ -136,6 +136,18 @@ int main(int argc, char **argv)
}
}
+#if !defined(HOST)
+ // Use only if -S option not requested
+ if (!sehnd && mountpoint[0] != '\0') {
+ sehnd = selinux_android_file_context_handle();
+
+ if (!sehnd) {
+ perror(optarg);
+ exit(EXIT_FAILURE);
+ }
+ }
+#endif
+
if (wipe && sparse) {
fprintf(stderr, "Cannot specifiy both wipe and sparse\n");
usage(argv[0]);