Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 31dc7aff authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Revert "Fix error checking in MemoryFile."

This reverts commit 2142c2cf.
Fix android.os.cts.MemoryFileTest#testLength
parent c688a84a
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -47,16 +47,15 @@ static jint android_os_MemoryFile_mmap(JNIEnv* env, jobject clazz, jobject fileD
        jint length, jint prot)
{
    int fd = jniGetFDFromFileDescriptor(env, fileDescriptor);
    void* result = mmap(NULL, length, prot, MAP_SHARED, fd, 0);
    if (result == MAP_FAILED) {
    jint result = (jint)mmap(NULL, length, prot, MAP_SHARED, fd, 0);
    if (!result)
        jniThrowException(env, "java/io/IOException", "mmap failed");
    }
    return reinterpret_cast<jlong>(result);
    return result;
}

static void android_os_MemoryFile_munmap(JNIEnv* env, jobject clazz, jint addr, jint length)
{
    int result = munmap(reinterpret_cast<void *>(addr), length);
    int result = munmap((void *)addr, length);
    if (result < 0)
        jniThrowException(env, "java/io/IOException", "munmap failed");
}