[flang] Apply nocapture attribute to dummy arguments (#116182)
[llvm-project.git] / compiler-rt / test / msan / if_indextoname.cpp
blob7b1b989e57d5fc1ac246534a7310482c8ed1b8e7
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
5 #include <assert.h>
6 #include <errno.h>
7 #include <net/if.h>
8 #include <stdio.h>
9 #include <string.h>
11 #include <sanitizer/msan_interface.h>
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(1, ifname)) {
17 assert(errno == ENXIO);
18 printf("No network interfaces found.\n");
19 return 0;
21 assert(strlen(ifname) + 1 <= __msan_test_shadow(ifname, sizeof(ifname)));
22 return 0;