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

Commit f68327e7 authored by Nick Kralevich's avatar Nick Kralevich
Browse files

Make installd resistant to umask changes.

Bug: 3272072
Change-Id: Ic2d241afcb4d0dabd63fcdadf13b2d48b7f398e8
parent 3758321f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -48,6 +48,11 @@ int install(const char *pkgname, uid_t uid, gid_t gid)
        LOGE("cannot create dir '%s': %s\n", pkgdir, strerror(errno));
        return -errno;
    }
    if (chmod(pkgdir, 0751) < 0) {
        LOGE("cannot chmod dir '%s': %s\n", pkgdir, strerror(errno));
        unlink(pkgdir);
        return -errno;
    }
    if (chown(pkgdir, uid, gid) < 0) {
        LOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno));
        unlink(pkgdir);
@@ -58,6 +63,12 @@ int install(const char *pkgname, uid_t uid, gid_t gid)
        unlink(pkgdir);
        return -errno;
    }
    if (chmod(libdir, 0755) < 0) {
        LOGE("cannot chmod dir '%s': %s\n", libdir, strerror(errno));
        unlink(libdir);
        unlink(pkgdir);
        return -errno;
    }
    if (chown(libdir, AID_SYSTEM, AID_SYSTEM) < 0) {
        LOGE("cannot chown dir '%s': %s\n", libdir, strerror(errno));
        unlink(libdir);