summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Salyzyn2016-03-02 09:51:48 -0600
committerMark Salyzyn2016-03-02 09:54:45 -0600
commitbf7d0b887561929d22c8e2efa5d86cb0d7c50b51 (patch)
tree26d80e7852e055538f9326c6cf145faf9d366059 /logd/main.cpp
parent0ecdec7a0922f5e99569c558fd3c6440b826e583 (diff)
downloadplatform-system-core-bf7d0b887561929d22c8e2efa5d86cb0d7c50b51.tar.gz
platform-system-core-bf7d0b887561929d22c8e2efa5d86cb0d7c50b51.tar.xz
platform-system-core-bf7d0b887561929d22c8e2efa5d86cb0d7c50b51.zip
logd: check return values
The setgid() and setuid() call failure in logd.daemon thread do not block overall functionality, so clearly tell static analyzer and developers that we do not care to check their return values. SideEffects: None Bug: 27434072 Change-Id: I6fdc87e8311ebc0173716080bbd72c86b3f00f78
Diffstat (limited to 'logd/main.cpp')
-rw-r--r--logd/main.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/logd/main.cpp b/logd/main.cpp
index f4d746416..3095f7f9d 100644
--- a/logd/main.cpp
+++ b/logd/main.cpp
@@ -165,7 +165,7 @@ bool property_get_bool(const char *key, int flag) {
165 char newkey[PROPERTY_KEY_MAX]; 165 char newkey[PROPERTY_KEY_MAX];
166 snprintf(newkey, sizeof(newkey), "ro.%s", key); 166 snprintf(newkey, sizeof(newkey), "ro.%s", key);
167 property_get(newkey, property, ""); 167 property_get(newkey, property, "");
168 // persist properties set by /data require innoculation with 168 // persist properties set by /data require inoculation with
169 // logd-reinit. They may be set in init.rc early and function, but 169 // logd-reinit. They may be set in init.rc early and function, but
170 // otherwise are defunct unless reset. Do not rely on persist 170 // otherwise are defunct unless reset. Do not rely on persist
171 // properties for startup-only keys unless you are willing to restart 171 // properties for startup-only keys unless you are willing to restart
@@ -265,8 +265,11 @@ static void *reinit_thread_start(void * /*obj*/) {
265 set_sched_policy(0, SP_BACKGROUND); 265 set_sched_policy(0, SP_BACKGROUND);
266 setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND); 266 setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND);
267 267
268 setgid(AID_SYSTEM); 268 // If we are AID_ROOT, we should drop to AID_SYSTEM, if we are anything
269 setuid(AID_SYSTEM); 269 // else, we have even lesser privileges and accept our fate. Not worth
270 // checking for error returns setting this thread's privileges.
271 (void)setgid(AID_SYSTEM);
272 (void)setuid(AID_SYSTEM);
270 273
271 while (reinit_running && !sem_wait(&reinit) && reinit_running) { 274 while (reinit_running && !sem_wait(&reinit) && reinit_running) {
272 275