Merge "logd: test: logd.sepolicy* errors" am: ebc87c98e3 am: d7acf56639
am: ef3ee4008f
Change-Id: Iac8023896bb6f26f36965f44ef0ec899ec604271
diff --git a/logd/tests/logd_test.cpp b/logd/tests/logd_test.cpp
index d0101ed..88cb67a 100644
--- a/logd/tests/logd_test.cpp
+++ b/logd/tests/logd_test.cpp
@@ -999,16 +999,18 @@
}
// 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));
- freecon(context);
- _exit(-1);
- // NOTREACHED
- return 0;
+ 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,