Debian Codegraph @

compiler-rt/test/sanitizer_common/TestCases/Posix/devname.cpp

raw
1 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
2 // UNSUPPORTED: target={{.*(linux|solaris).*}}
3
4 #include <assert.h>
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <sys/stat.h>
8
9 int main(void) {
10 struct stat st;
11 char *name;
12
13 assert(!stat("/dev/null", &st));
14 assert((name = devname(st.st_rdev, S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK)));
15
16 printf("%s\n", name);
17
18 // CHECK: null
19
20 return 0;
21 }