summaryrefslogtreecommitdiff
path: root/test/sanitizer_common/TestCases/Posix/devname_r.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/sanitizer_common/TestCases/Posix/devname_r.cc')
-rw-r--r--test/sanitizer_common/TestCases/Posix/devname_r.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/test/sanitizer_common/TestCases/Posix/devname_r.cc b/test/sanitizer_common/TestCases/Posix/devname_r.cc
index 826b7c92ef2fa..ae10a766271e1 100644
--- a/test/sanitizer_common/TestCases/Posix/devname_r.cc
+++ b/test/sanitizer_common/TestCases/Posix/devname_r.cc
@@ -4,6 +4,7 @@
#include <sys/cdefs.h>
#include <sys/stat.h>
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
@@ -12,13 +13,15 @@ int main(void) {
char name[100];
mode_t type;
- if (stat("/dev/null", &st))
- exit(1);
+ assert(!stat("/dev/null", &st));
type = S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK;
- if (!devname_r(st.st_rdev, type, name, sizeof(name)))
- exit(1);
+#if defined(__NetBSD__)
+ assert(!devname_r(st.st_rdev, type, name, sizeof(name)));
+#else
+ assert(devname_r(st.st_rdev, type, name, sizeof(name)));
+#endif
printf("%s\n", name);