diff options
author | Jin Qian <jinqian@google.com> | 2017-07-06 16:06:07 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-07-06 16:06:07 +0000 |
commit | 3ac608fd1bf017f039afe8a57f57acd351f56186 (patch) | |
tree | 0d46ff8fff09b5879bb0d09645aa626d6d4567c8 | |
parent | 6243f2136f94c50e4a930a683b3344003d93a780 (diff) | |
parent | 2fff6fb036cbbb6dedd7da3d208b312a9038a5ce (diff) | |
download | android_external_e2fsprogs-3ac608fd1bf017f039afe8a57f57acd351f56186.tar.gz android_external_e2fsprogs-3ac608fd1bf017f039afe8a57f57acd351f56186.tar.bz2 android_external_e2fsprogs-3ac608fd1bf017f039afe8a57f57acd351f56186.zip |
e2fsdroid: use libselinux function to read file context on device
am: 2fff6fb036
Change-Id: I2dd7351c28c20239e70796ce04eddf838587a08e
-rw-r--r-- | contrib/android/perms.c | 9 | ||||
-rw-r--r-- | contrib/android/perms.h | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/contrib/android/perms.c b/contrib/android/perms.c index 9a7a93f5..9ae8e586 100644 --- a/contrib/android/perms.c +++ b/contrib/android/perms.c @@ -297,6 +297,7 @@ errcode_t android_configure_fs(ext2_filsys fs, char *src_dir, char *target_out, struct selabel_handle *sehnd = NULL; /* Retrieve file contexts */ +#if !defined(__ANDROID__) if (nopt > 0) { sehnd = selabel_open(SELABEL_CTX_FILE, seopts, nopt); if (!sehnd) { @@ -306,6 +307,14 @@ errcode_t android_configure_fs(ext2_filsys fs, char *src_dir, char *target_out, return -EINVAL; } } +#else + sehnd = selinux_android_file_context_handle(); + if (!sehnd) { + com_err(__func__, -EINVAL, + _("while opening android file_contexts")); + return -EINVAL; + } +#endif /* Load the FS config */ if (fs_config_file) { diff --git a/contrib/android/perms.h b/contrib/android/perms.h index 9955bb56..c404cb90 100644 --- a/contrib/android/perms.h +++ b/contrib/android/perms.h @@ -25,7 +25,7 @@ static inline errcode_t android_configure_fs(ext2_filsys fs, # else # include <selinux/selinux.h> # include <selinux/label.h> -# if !defined(HOST) +# if defined(__ANDROID__) # include <selinux/android.h> # endif # include <private/android_filesystem_config.h> |