summaryrefslogtreecommitdiffstats
path: root/liblog
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2010-07-16 13:34:53 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-07-16 13:34:53 -0700
commit4e246965bbd124bad1c1d98c5936d13b4db0d566 (patch)
tree65a9be838a789cb38a03645c2e0ac9d284bf03e7 /liblog
parent534bc027a2fc5136988e6785c2d647054daf2713 (diff)
parent64ba76c1431afe17c1f4553f1dbc595db064316e (diff)
downloadsystem_core-4e246965bbd124bad1c1d98c5936d13b4db0d566.zip
system_core-4e246965bbd124bad1c1d98c5936d13b4db0d566.tar.gz
system_core-4e246965bbd124bad1c1d98c5936d13b4db0d566.tar.bz2
am 64ba76c1: merge from open-source master
Merge commit '64ba76c1431afe17c1f4553f1dbc595db064316e' * commit '64ba76c1431afe17c1f4553f1dbc595db064316e': Fixed LOG_ASSERT() compilation errors in native debug builds.
Diffstat (limited to 'liblog')
-rw-r--r--liblog/logd_write.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/liblog/logd_write.c b/liblog/logd_write.c
index 9923bba..a0a753b 100644
--- a/liblog/logd_write.c
+++ b/liblog/logd_write.c
@@ -56,7 +56,7 @@ static int log_fds[(int)LOG_ID_MAX] = { -1, -1, -1, -1 };
* the simulator rather than a desktop tool and want to use the device.
*/
static enum {
- kLogUninitialized, kLogNotAvailable, kLogAvailable
+ kLogUninitialized, kLogNotAvailable, kLogAvailable
} g_log_status = kLogUninitialized;
int __android_log_dev_available(void)
{
@@ -189,7 +189,7 @@ int __android_log_buf_write(int bufID, int prio, const char *tag, const char *ms
int __android_log_vprint(int prio, const char *tag, const char *fmt, va_list ap)
{
- char buf[LOG_BUF_SIZE];
+ char buf[LOG_BUF_SIZE];
vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
@@ -223,12 +223,23 @@ int __android_log_buf_print(int bufID, int prio, const char *tag, const char *fm
void __android_log_assert(const char *cond, const char *tag,
const char *fmt, ...)
{
- va_list ap;
- char buf[LOG_BUF_SIZE];
+ char buf[LOG_BUF_SIZE];
- va_start(ap, fmt);
- vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
- va_end(ap);
+ if (fmt) {
+ va_list ap;
+ va_start(ap, fmt);
+ vsnprintf(buf, LOG_BUF_SIZE, fmt, ap);
+ va_end(ap);
+ } else {
+ /* Msg not provided, log condition. N.B. Do not use cond directly as
+ * format string as it could contain spurious '%' syntax (e.g.
+ * "%d" in "blocks%devs == 0").
+ */
+ if (cond)
+ snprintf(buf, LOG_BUF_SIZE, "Assertion failed: %s", cond);
+ else
+ strcpy(buf, "Unspecified assertion failed");
+ }
__android_log_write(ANDROID_LOG_FATAL, tag, buf);