[PATCH] D56150: [sanitizer_common] Fix devname_r() return type on !NetBSD

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Dec 29 09:29:08 PST 2018


mgorny updated this revision to Diff 179696.
mgorny added a comment.

Fixed lint.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56150/new/

https://reviews.llvm.org/D56150

Files:
  lib/sanitizer_common/sanitizer_common_interceptors.inc


Index: lib/sanitizer_common/sanitizer_common_interceptors.inc
===================================================================
--- lib/sanitizer_common/sanitizer_common_interceptors.inc
+++ lib/sanitizer_common/sanitizer_common_interceptors.inc
@@ -7067,12 +7067,20 @@
 #endif
 
 #if SANITIZER_INTERCEPT_DEVNAME_R
-INTERCEPTOR(int, devname_r, u64 dev, u32 type, char *path, uptr len) {
+#if SANITIZER_NETBSD
+#define DEVNAME_R_RETTYPE int
+#define DEVNAME_R_SUCCESS(x) (!(x))
+#else
+#define DEVNAME_R_RETTYPE char*
+#define DEVNAME_R_SUCCESS(x) (x)
+#endif
+INTERCEPTOR(DEVNAME_R_RETTYPE, devname_r, u64 dev, u32 type, char *path,
+            uptr len) {
   void *ctx;
-  int res;
+  DEVNAME_R_RETTYPE res;
   COMMON_INTERCEPTOR_ENTER(ctx, devname_r, dev, type, path, len);
   res = REAL(devname_r)(dev, type, path, len);
-  if (!res)
+  if (DEVNAME_R_SUCCESS(res))
     COMMON_INTERCEPTOR_WRITE_RANGE(ctx, path, REAL(strlen)(path) + 1);
   return res;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56150.179696.patch
Type: text/x-patch
Size: 961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181229/6adde135/attachment.bin>


More information about the cfe-commits mailing list