Revert "Revert^2 "modprobe: Always log failures to the kernel lo..."
Revert submission 3442704-modprobe-kmsg-sepolicy
Reason for revert: Likely culprit for b/391279588 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.
Reverted changes: /q/submissionid:3442704-modprobe-kmsg-sepolicy
Change-Id: Ibf0e47c9775de71cdbb9f4b5e4aac8da3acc5d04
diff --git a/toolbox/modprobe.cpp b/toolbox/modprobe.cpp
index fa6297d..13026ac 100644
--- a/toolbox/modprobe.cpp
+++ b/toolbox/modprobe.cpp
@@ -52,7 +52,7 @@
LOG(INFO) << " -h, --help: Print this help";
LOG(INFO) << " -l, --list: List modules matching pattern";
LOG(INFO) << " -r, --remove: Remove MODULE (multiple modules may be specified)";
- LOG(INFO) << " -s, --syslog: print to syslog also (deprecated)";
+ LOG(INFO) << " -s, --syslog: print to syslog also";
LOG(INFO) << " -q, --quiet: disable messages";
LOG(INFO) << " -v, --verbose: enable more messages, even more with a second -v";
LOG(INFO);
@@ -76,10 +76,12 @@
/* NOTREACHED */
}
+auto syslog = false;
+
void MyLogger(android::base::LogId id, android::base::LogSeverity severity, const char* tag,
const char* file, unsigned int line, const char* message) {
android::base::StdioLogger(id, severity, tag, file, line, message);
- if (message[0]) {
+ if (syslog && message[0]) {
android::base::KernelLogger(id, severity, tag, file, line, message);
}
}
@@ -198,6 +200,7 @@
mode = RemoveModulesMode;
break;
case 's':
+ syslog = true;
break;
case 'v':
if (android::base::GetMinimumLogSeverity() <= android::base::DEBUG) {