From ef855954de3cfe4dc9e0446c826f8384364724ab Mon Sep 17 00:00:00 2001 From: Tom Cherry Date: Thu, 16 Apr 2020 11:20:29 -0700 Subject: [PATCH] liblog: return -EPERM if a log_is_loggable() returns false This was the previous behavior, so retain it. Bug: 119867234 Test: logging unit tests Merged-In: I088f760cc274a4a42d72477eb4e2e8d23c613a8a Change-Id: I088f760cc274a4a42d72477eb4e2e8d23c613a8a (cherry picked from commit 1ff17fcebb09c100e674c88235d32428da3f63e8) --- liblog/logger_write.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/liblog/logger_write.cpp b/liblog/logger_write.cpp index 7c78ea19c..74b0ab986 100644 --- a/liblog/logger_write.cpp +++ b/liblog/logger_write.cpp @@ -330,7 +330,7 @@ int __android_log_buf_write(int bufID, int prio, const char* tag, const char* ms ErrnoRestorer errno_restorer; if (!__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) { - return 0; + return -EPERM; } __android_log_message log_message = { @@ -343,7 +343,7 @@ int __android_log_vprint(int prio, const char* tag, const char* fmt, va_list ap) ErrnoRestorer errno_restorer; if (!__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) { - return 0; + return -EPERM; } char buf[LOG_BUF_SIZE]; @@ -360,7 +360,7 @@ int __android_log_print(int prio, const char* tag, const char* fmt, ...) { ErrnoRestorer errno_restorer; if (!__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) { - return 0; + return -EPERM; } va_list ap; @@ -380,7 +380,7 @@ int __android_log_buf_print(int bufID, int prio, const char* tag, const char* fm ErrnoRestorer errno_restorer; if (!__android_log_is_loggable(prio, tag, ANDROID_LOG_VERBOSE)) { - return 0; + return -EPERM; } va_list ap;