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