[compiler-rt] r343980 - Fix Posix/devname_r for NetBSD

Kamil Rytarowski via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 8 10:06:00 PDT 2018


Author: kamil
Date: Mon Oct  8 10:06:00 2018
New Revision: 343980

URL: http://llvm.org/viewvc/llvm-project?rev=343980&view=rev
Log:
Fix Posix/devname_r for NetBSD

NetBSD returns a different type as a return value of
devname_r(3) than FreeBSD and Darwin (int vs char*).

This implies that checking for successful completion of this
function has to be handled differently.

This test used to work well, but was switched to fix Darwin,
which broke NetBSD.

Add a dedicated ifdef for NetBSD and make it functional again
for this OS.

Modified:
    compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname_r.cc

Modified: compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname_r.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname_r.cc?rev=343980&r1=343979&r2=343980&view=diff
==============================================================================
--- compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname_r.cc (original)
+++ compiler-rt/trunk/test/sanitizer_common/TestCases/Posix/devname_r.cc Mon Oct  8 10:06:00 2018
@@ -17,8 +17,13 @@ int main(void) {
 
   type = S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK;
 
+#if defined(__NetBSD__)
+  if (devname_r(st.st_rdev, type, name, sizeof(name)))
+    exit(1);
+#else
   if (!devname_r(st.st_rdev, type, name, sizeof(name)))
     exit(1);
+#endif
 
   printf("%s\n", name);
 




More information about the llvm-commits mailing list