summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2019-01-31 10:22:02 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-01-31 10:22:02 +0000
commit1120b649f6b369da7701f300d00e44faa659a1ac (patch)
treed37dc403a2f72742b8f839dd9decd5c168fcb393
parentb4dca46279fb52863cfd26a5e983378d400c85b7 (diff)
parent85958b64584bdedb7fca628c1e8e042cd680da5b (diff)
Merge "installd: Create "lib" symlink with the correct label."
-rw-r--r--cmds/installd/InstalldNativeService.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/cmds/installd/InstalldNativeService.cpp b/cmds/installd/InstalldNativeService.cpp
index 7da5642fa3..8146cc6f98 100644
--- a/cmds/installd/InstalldNativeService.cpp
+++ b/cmds/installd/InstalldNativeService.cpp
@@ -2046,8 +2046,14 @@ binder::Status InstalldNativeService::linkNativeLibraryDirectory(
return error("Failed to stat " + _pkgdir);
}
+ char *con = nullptr;
+ if (lgetfilecon(pkgdir, &con) < 0) {
+ return error("Failed to lgetfilecon " + _pkgdir);
+ }
+
if (chown(pkgdir, AID_INSTALL, AID_INSTALL) < 0) {
- return error("Failed to chown " + _pkgdir);
+ res = error("Failed to chown " + _pkgdir);
+ goto out;
}
if (chmod(pkgdir, 0700) < 0) {
@@ -2079,7 +2085,13 @@ binder::Status InstalldNativeService::linkNativeLibraryDirectory(
goto out;
}
+ if (lsetfilecon(libsymlink, con) < 0) {
+ res = error("Failed to lsetfilecon " + _libsymlink);
+ goto out;
+ }
+
out:
+ free(con);
if (chmod(pkgdir, s.st_mode) < 0) {
auto msg = "Failed to cleanup chmod " + _pkgdir;
if (res.isOk()) {