| 1 | // RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1 |
|---|---|
| 2 | // RUN: %clangxx_msan -O0 -D_FILE_OFFSET_BITS=64 %s -o %t && %run %t 2>&1 |
| 3 | // RUN: %clangxx_msan -O3 %s -o %t && %run %t 2>&1 |
| 4 | |
| 5 | #include <assert.h> |
| 6 | #include <errno.h> |
| 7 | #include <net/if.h> |
| 8 | #include <stdio.h> |
| 9 | #include <string.h> |
| 10 | |
| 11 | #include <sanitizer/msan_interface.h> |
| 12 | |
| 13 | int main(int argc, char *argv[]) { |
| 14 | char ifname[IF_NAMESIZE + 1]; |
| 15 | assert(0 == __msan_test_shadow(ifname, sizeof(ifname))); |
| 16 | if (!if_indextoname(ifindex: 1, ifname: ifname)) { |
| 17 | assert(errno == ENXIO); |
| 18 | printf(format: "No network interfaces found.\n"); |
| 19 | return 0; |
| 20 | } |
| 21 | assert(strlen(ifname) + 1 <= __msan_test_shadow(ifname, sizeof(ifname))); |
| 22 | return 0; |
| 23 | } |
| 24 |
