summaryrefslogtreecommitdiffstats
path: root/logd/main.cpp
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2016-03-02 07:51:48 -0800
committerMark Salyzyn <salyzyn@google.com>2016-03-02 11:37:21 -0800
commit07522c6e9b8acba0f5cfb274d4514014749475e8 (patch)
treeb7e1fea26a947b8949e68955c2265bebeceef174 /logd/main.cpp
parentc3484161980cdea915c893a233f54b14a75d151f (diff)
downloadsystem_core-07522c6e9b8acba0f5cfb274d4514014749475e8.tar.gz
system_core-07522c6e9b8acba0f5cfb274d4514014749475e8.tar.bz2
system_core-07522c6e9b8acba0f5cfb274d4514014749475e8.zip
logd: check return values
(cherry pick from commit bf7d0b887561929d22c8e2efa5d86cb0d7c50b51) 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 aa5718e14..11c9372f3 100644
--- a/logd/main.cpp
+++ b/logd/main.cpp
@@ -165,7 +165,7 @@ bool property_get_bool(const char *key, int flag) {
char newkey[PROPERTY_KEY_MAX];
snprintf(newkey, sizeof(newkey), "ro.%s", key);
property_get(newkey, property, "");
- // persist properties set by /data require innoculation with
+ // persist properties set by /data require inoculation with
// logd-reinit. They may be set in init.rc early and function, but
// otherwise are defunct unless reset. Do not rely on persist
// properties for startup-only keys unless you are willing to restart
@@ -243,8 +243,11 @@ static void *reinit_thread_start(void * /*obj*/) {
set_sched_policy(0, SP_BACKGROUND);
setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND);
- setgid(AID_SYSTEM);
- setuid(AID_SYSTEM);
+ // If we are AID_ROOT, we should drop to AID_SYSTEM, if we are anything
+ // else, we have even lesser privileges and accept our fate. Not worth
+ // checking for error returns setting this thread's privileges.
+ (void)setgid(AID_SYSTEM);
+ (void)setuid(AID_SYSTEM);
while (reinit_running && !sem_wait(&reinit) && reinit_running) {