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

Commit ef3ee400 authored by Mark Salyzyn's avatar Mark Salyzyn Committed by android-build-merger
Browse files

Merge "logd: test: logd.sepolicy* errors" am: ebc87c98

am: d7acf566

Change-Id: I9a082d481c0b277f0c9ce8e79d16edd7c4b08a1a
parents 0d3803f3 d7acf566
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -999,17 +999,19 @@ static pid_t sepolicy_rate(unsigned rate, unsigned num) {
    }

    // We may have DAC, but let's not have MAC
    if (setcon("u:object_r:shell:s0") < 0) {
    if ((setcon("u:object_r:shell:s0") < 0) && (setcon("u:r:shell:s0") < 0)) {
        int save_errno = errno;
        security_context_t context;
        getcon(&context);
        fprintf(stderr, "setcon(\"u:r:shell:s0\") failed @\"%s\" %s\n", context,
                strerror(save_errno));
        if (strcmp(context, "u:r:shell:s0")) {
            fprintf(stderr, "setcon(\"u:r:shell:s0\") failed @\"%s\" %s\n",
                    context, strerror(save_errno));
            freecon(context);
            _exit(-1);
            // NOTREACHED
            return 0;
        }
    }

    // The key here is we are root, but we are in u:r:shell:s0,
    // and the directory does not provide us DAC access