logd: klogd crash (part deux)
am: f34d76ea65
Change-Id: I12f3eceea8af248ddb3f3c4c00f85f8ec6e73131
diff --git a/logd/LogKlog.cpp b/logd/LogKlog.cpp
index da0aecc..c7506ef 100644
--- a/logd/LogKlog.cpp
+++ b/logd/LogKlog.cpp
@@ -26,6 +26,7 @@
#include <syslog.h>
#include <log/logger.h>
+#include <private/android_filesystem_config.h>
#include "LogBuffer.h"
#include "LogKlog.h"
@@ -614,7 +615,12 @@
// Parse pid, tid and uid
const pid_t pid = sniffPid(&p, len - (p - buf));
const pid_t tid = pid;
- const uid_t uid = pid ? logbuf->pidToUid(pid) : 0;
+ uid_t uid = AID_ROOT;
+ if (pid) {
+ logbuf->lock();
+ uid = logbuf->pidToUid(pid);
+ logbuf->unlock();
+ }
// Parse (rules at top) to pull out a tag from the incoming kernel message.
// Some may view the following as an ugly heuristic, the desire is to