Properly fix sigchain EnsureFrontOfChain test.
Test: art_sigchain_tests on host
Change-Id: I051062192b0068571732af1f968455952b9a3207
diff --git a/sigchainlib/sigchain_test.cc b/sigchainlib/sigchain_test.cc
index dfa3b37..249fff1 100644
--- a/sigchainlib/sigchain_test.cc
+++ b/sigchainlib/sigchain_test.cc
@@ -214,16 +214,20 @@
void* libc = dlopen(kLibcSoName, RTLD_LAZY | RTLD_NOLOAD);
ASSERT_TRUE(libc);
+ auto libc_sigaction = reinterpret_cast<decltype(&sigaction)>(dlsym(libc, "sigaction"));
+ ASSERT_TRUE(libc_sigaction);
+
static sig_atomic_t called = 0;
struct sigaction action = {};
action.sa_flags = SA_SIGINFO;
action.sa_sigaction = [](int, siginfo_t*, void*) { called = 1; };
- ASSERT_EQ(0, sigaction(SIGSEGV, &action, nullptr));
+ ASSERT_EQ(0, libc_sigaction(SIGSEGV, &action, nullptr));
// Try before EnsureFrontOfChain.
RaiseHandled();
- ASSERT_EQ(0, called);
+ ASSERT_EQ(1, called);
+ called = 0;
RaiseUnhandled();
ASSERT_EQ(1, called);