From 2760778d7020c31f6b7c28383b0db6e0bef99754 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 8 Apr 2014 15:21:50 -0700 Subject: [PATCH] jni: liblog reading error API incorrect - return value contains -errno on error. (cherry pick from commit b519aeca47a7b798926c00ce5c8cf730e26e75fd) Bug: 13907124 Change-Id: I91f12db5749fac2ae8ed5b0f033d4eaf83e666f5 --- core/jni/android_util_EventLog.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/jni/android_util_EventLog.cpp b/core/jni/android_util_EventLog.cpp index 25934200e0c99..8a0eaa26acda9 100644 --- a/core/jni/android_util_EventLog.cpp +++ b/core/jni/android_util_EventLog.cpp @@ -177,13 +177,13 @@ static void android_util_EventLog_readEvents(JNIEnv* env, jobject clazz UNUSED, break; } if (ret < 0) { - if (errno == EINTR) { + if (ret == -EINTR) { continue; } - if (errno == EINVAL) { + if (ret == -EINVAL) { jniThrowException(env, "java/io/IOException", "Event too short"); - } else if (errno != EAGAIN) { - jniThrowIOException(env, errno); // Will throw on return + } else if (ret != -EAGAIN) { + jniThrowIOException(env, -ret); // Will throw on return } break; }