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

Commit d15d2252 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

installd: Run all of the appt setup operations in the child process

Change-Id: Ifc18741380d7f922540d04ef622f17edfd87dbdf
parent 716c2cf3
Loading
Loading
Loading
Loading
+22 −22
Original line number Diff line number Diff line
@@ -1761,6 +1761,7 @@ int aapt(const char *source_apk, const char *internal_path, const char *out_rest

    pid_t pid = fork();

    if (pid == 0) {
        // get file descriptor for resources.arsc
        snprintf(restable_path, PATH_MAX, "%s/resources.arsc", out_restable);
        unlink(restable_path);
@@ -1782,7 +1783,6 @@ int aapt(const char *source_apk, const char *internal_path, const char *out_rest
            goto fail;
        }

    if (pid == 0) {
        /* child -- drop privileges before continuing */
        if (setgid(uid) != 0) {
            ALOGE("setgid(%d) failed during aapt\n", uid);
@@ -1807,6 +1807,7 @@ int aapt(const char *source_apk, const char *internal_path, const char *out_rest

        run_aapt(source_apk, internal_path, resapk_fd, pkgId, min_sdk_version, common_res_path);

        close(resapk_fd);
        if (pipefd[CHILD_WRITE_PIPE] > 0) {
            close(pipefd[CHILD_WRITE_PIPE]);
        }
@@ -1845,7 +1846,6 @@ int aapt(const char *source_apk, const char *internal_path, const char *out_rest
        }
    }

    close(resapk_fd);
    return 0;
fail:
    if (resapk_fd >= 0) {