26 lines · cpp
1// RUN: %clangxx_msan -O0 -g %s -o %t2// RUN: env MSAN_OPTIONS=handle_segv=2 %t 2>&1 | FileCheck %s3#include <stdlib.h>4#include <stdio.h>5#include <unistd.h>6#include <signal.h>7#include <string.h>8 9extern "C" int __interceptor_sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);10extern "C" int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact) {11 write(2, "sigaction call\n", sizeof("sigaction call\n") - 1);12 return __interceptor_sigaction(signum, act, oldact);13}14 15int main() {16 struct sigaction oldact;17 sigaction(SIGSEGV, nullptr, &oldact);18 19 if (oldact.sa_handler || oldact.sa_sigaction) {20 fprintf(stderr, "oldact filled\n");21 }22 return 0;23 // CHECK: sigaction call24 // CHECK: oldact filled25}26