summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-01-03 22:21:37 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-01-03 22:21:37 +0000
commit5badada997f8a83ba031e1c8625c6daf43006b92 (patch)
tree7aa24773982bcce1aef9e4c11391ff24696687b3
parent891df1c4103739149ad17afb28093b8025eb6179 (diff)
parent2e588677716f3e7f84c6274aeeb943efd6b96770 (diff)
downloadsystem_core-5badada997f8a83ba031e1c8625c6daf43006b92.tar.gz
system_core-5badada997f8a83ba031e1c8625c6daf43006b92.tar.bz2
system_core-5badada997f8a83ba031e1c8625c6daf43006b92.zip
Merge "LogAudit.cpp: replace newlines with spaces in audit messages"
-rw-r--r--logd/LogAudit.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/logd/LogAudit.cpp b/logd/LogAudit.cpp
index c26716d55..11ffcb785 100644
--- a/logd/LogAudit.cpp
+++ b/logd/LogAudit.cpp
@@ -98,6 +98,13 @@ int LogAudit::logPrint(const char *fmt, ...) {
}
char *cp;
+ // Work around kernels missing
+ // https://github.com/torvalds/linux/commit/b8f89caafeb55fba75b74bea25adc4e4cd91be67
+ // Such kernels improperly add newlines inside audit messages.
+ while ((cp = strchr(str, '\n'))) {
+ *cp = ' ';
+ }
+
while ((cp = strstr(str, " "))) {
memmove(cp, cp + 1, strlen(cp + 1) + 1);
}