Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ee93b5f authored by Nick Kralevich's avatar Nick Kralevich Committed by android-build-merger
Browse files

Merge "installd: Create "lib" symlink with the correct label."

am: 1120b649

Change-Id: I4fda03a9c6d3d49b314c42ef62ce3e96e6ae3b81
parents a5bb889b 1120b649
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -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()) {