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

Commit 57c63d8f authored by Kenny Root's avatar Kenny Root
Browse files

Fix mistaken removal of setfilecon

Previous commit attempted to move setfilecon above chown, but mistakenly
squashed libdir and pkgdir setfilcon into one incorrect setfilecon.

Change-Id: I1ad00eae8a0e69ae88ce47cd5571558ce1ad2145
parent 85f9ba9e
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -73,13 +73,20 @@ int install(const char *pkgname, uid_t uid, gid_t gid)
        return -errno;
    }

    if (selinux_android_setfilecon(libdir, pkgname, uid) < 0) {
    if (selinux_android_setfilecon(libdir, pkgname, AID_SYSTEM) < 0) {
        ALOGE("cannot setfilecon dir '%s': %s\n", libdir, strerror(errno));
        unlink(libdir);
        unlink(pkgdir);
        return -errno;
    }

    if (selinux_android_setfilecon(pkgdir, pkgname, uid) < 0) {
        ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno));
        unlink(libdir);
        unlink(pkgdir);
        return -errno;
    }

    if (chown(pkgdir, uid, gid) < 0) {
        ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
        unlink(libdir);