diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2018-03-12 22:04:51 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-03-12 22:04:51 +0000 |
commit | 5f38431b1d1ca07f89dd69ab4779ee74745035a7 (patch) | |
tree | a6bfa953a427dd0881433cbe848a5c4412c56976 | |
parent | 4ec3af49a59ae07d863cb4e2686a1b326c8ad265 (diff) | |
parent | 5fce47996fdda5ddd09fa8e1b691721a41e0dc6e (diff) | |
download | bionic-5f38431b1d1ca07f89dd69ab4779ee74745035a7.tar.gz |
Merge "Snap for 4649556 from f050493ebf19c98dcb04386c3610bac8038f27fd to oreo-cts-release" into oreo-cts-releaseandroid-cts-8.0_r9android-cts-8.0_r8android-cts-8.0_r26android-cts-8.0_r25android-cts-8.0_r24android-cts-8.0_r23android-cts-8.0_r22android-cts-8.0_r21android-cts-8.0_r20android-cts-8.0_r19android-cts-8.0_r18android-cts-8.0_r17android-cts-8.0_r16android-cts-8.0_r15android-cts-8.0_r14android-cts-8.0_r13android-cts-8.0_r12android-cts-8.0_r11android-cts-8.0_r10oreo-cts-release
-rw-r--r-- | tests/dlfcn_test.cpp | 18 | ||||
-rw-r--r-- | tests/libs/check_rtld_next_from_library.cpp | 17 |
2 files changed, 18 insertions, 17 deletions
diff --git a/tests/dlfcn_test.cpp b/tests/dlfcn_test.cpp index ad8444e93..f72df8164 100644 --- a/tests/dlfcn_test.cpp +++ b/tests/dlfcn_test.cpp @@ -1069,17 +1069,17 @@ TEST(dlfcn, rtld_next_known_symbol) { // Check that RTLD_NEXT of a libc symbol works in dlopened library TEST(dlfcn, rtld_next_from_library) { - void* library_with_close = dlopen("libtest_check_rtld_next_from_library.so", RTLD_NOW); - ASSERT_TRUE(library_with_close != nullptr) << dlerror(); - void* expected_addr = dlsym(RTLD_DEFAULT, "close"); + void* library_with_fclose = dlopen("libtest_check_rtld_next_from_library.so", RTLD_NOW); + ASSERT_TRUE(library_with_fclose != nullptr) << dlerror(); + void* expected_addr = dlsym(RTLD_DEFAULT, "fclose"); ASSERT_TRUE(expected_addr != nullptr) << dlerror(); - typedef void* (*get_libc_close_ptr_fn_t)(); - get_libc_close_ptr_fn_t get_libc_close_ptr = - reinterpret_cast<get_libc_close_ptr_fn_t>(dlsym(library_with_close, "get_libc_close_ptr")); - ASSERT_TRUE(get_libc_close_ptr != nullptr) << dlerror(); - ASSERT_EQ(expected_addr, get_libc_close_ptr()); + typedef void* (*get_libc_fclose_ptr_fn_t)(); + get_libc_fclose_ptr_fn_t get_libc_fclose_ptr = + reinterpret_cast<get_libc_fclose_ptr_fn_t>(dlsym(library_with_fclose, "get_libc_fclose_ptr")); + ASSERT_TRUE(get_libc_fclose_ptr != nullptr) << dlerror(); + ASSERT_EQ(expected_addr, get_libc_fclose_ptr()); - dlclose(library_with_close); + dlclose(library_with_fclose); } diff --git a/tests/libs/check_rtld_next_from_library.cpp b/tests/libs/check_rtld_next_from_library.cpp index 45d8eea35..fb15e2abc 100644 --- a/tests/libs/check_rtld_next_from_library.cpp +++ b/tests/libs/check_rtld_next_from_library.cpp @@ -15,22 +15,23 @@ */ #include <dlfcn.h> +#include <stdio.h> #include <stdlib.h> -static void* g_libc_close_ptr; +static void* g_libc_fclose_ptr; -static void __attribute__((constructor)) __libc_close_lookup() { - g_libc_close_ptr = dlsym(RTLD_NEXT, "close"); +static void __attribute__((constructor)) __libc_fclose_lookup() { + g_libc_fclose_ptr = dlsym(RTLD_NEXT, "fclose"); } -// A libc function used for RTLD_NEXT -// This function in not supposed to be called -extern "C" int __attribute__((weak)) close(int) { +// A libc function used for RTLD_NEXT. +// This function in not supposed to be called. +extern "C" int __attribute__((weak)) fclose(FILE*) { abort(); } -extern "C" void* get_libc_close_ptr() { - return g_libc_close_ptr; +extern "C" void* get_libc_fclose_ptr() { + return g_libc_fclose_ptr; } |