summaryrefslogtreecommitdiffstats
path: root/src/dir.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-05-25 14:19:21 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-05-25 14:30:05 -0400
commit24a67ef8265e5873c0967ded296a9e57ed9f2914 (patch)
treeab48ef165aa5f83465b99354794787914f4dd9a9 /src/dir.c
parenteef75524aec3910097cb6923c30b898ad98179fe (diff)
downloadbfs-24a67ef8265e5873c0967ded296a9e57ed9f2914.tar.xz
sanity: Add wrappers for sanitizer interfaces
Diffstat (limited to 'src/dir.c')
-rw-r--r--src/dir.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/dir.c b/src/dir.c
index d9ee63b..01d26db 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -5,6 +5,7 @@
#include "bfstd.h"
#include "config.h"
#include "diag.h"
+#include "sanity.h"
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
@@ -18,18 +19,13 @@
#endif
#if BFS_GETDENTS
-# if __has_feature(memory_sanitizer)
-# include <sanitizer/msan_interface.h>
-# endif
# if __linux__
# include <sys/syscall.h>
# endif
/** getdents() syscall wrapper. */
static ssize_t bfs_getdents(int fd, void *buf, size_t size) {
-#if __has_feature(memory_sanitizer)
- __msan_allocated_memory(buf, size);
-#endif
+ sanitize_uninit(buf, size);
#if __linux__ && __GLIBC__ && !__GLIBC_PREREQ(2, 30)
ssize_t ret = syscall(SYS_getdents64, fd, buf, size);
@@ -39,11 +35,9 @@ static ssize_t bfs_getdents(int fd, void *buf, size_t size) {
ssize_t ret = getdents(fd, buf, size);
#endif
-#if __has_feature(memory_sanitizer)
if (ret > 0) {
- __msan_unpoison(buf, ret);
+ sanitize_init(buf, ret);
}
-#endif
return ret;
}