Fix belated review comments on syslog change.
Bug: 14292866
Change-Id: I3cd92084cb55b5673f6ba62d51952941b79deb51
diff --git a/libc/bionic/libc_logging.cpp b/libc/bionic/libc_logging.cpp
index d6fa1db..b57e242 100644
--- a/libc/bionic/libc_logging.cpp
+++ b/libc/bionic/libc_logging.cpp
@@ -230,6 +230,7 @@
/* Perform formatted output to an output target 'o' */
template <typename Out>
static void out_vformat(Out& o, const char* format, va_list args) {
+ int caller_errno = errno;
int nn = 0;
for (;;) {
@@ -380,7 +381,7 @@
buffer[1] = '\0';
} else if (c == 'm') {
// syslog-like %m for strerror(errno).
- str = strerror(errno);
+ str = strerror(caller_errno);
} else {
__assert(__FILE__, __LINE__, "conversion specifier unsupported");
}
diff --git a/libc/bionic/syslog.cpp b/libc/bionic/syslog.cpp
index 7e153eb..29f892a 100644
--- a/libc/bionic/syslog.cpp
+++ b/libc/bionic/syslog.cpp
@@ -14,9 +14,8 @@
* limitations under the License.
*/
-#include <syslog.h>
-
#include <stdlib.h>
+#include <syslog.h>
#include "private/libc_logging.h"
@@ -24,6 +23,7 @@
static int syslog_priority_mask = 0xff;
void closelog() {
+ syslog_log_tag = NULL;
}
void openlog(const char* log_tag, int /*options*/, int /*facility*/) {
@@ -61,7 +61,7 @@
// What's our Android log priority?
priority &= LOG_PRIMASK;
int android_log_priority;
- if (priority < LOG_ERR) {
+ if (priority <= LOG_ERR) {
android_log_priority = ANDROID_LOG_ERROR;
} else if (priority == LOG_WARNING) {
android_log_priority = ANDROID_LOG_WARN;