From 185026706d926d1f94bd1c42a11dd83e6b8e74ec Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Thu, 31 Jan 2019 23:50:25 -0500 Subject: stat: Work around msan not knowing about statx() --- stat.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'stat.c') diff --git a/stat.c b/stat.c index 47585b8..d223ff8 100644 --- a/stat.c +++ b/stat.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -161,6 +162,12 @@ static int bfs_stat_impl(int at_fd, const char *at_path, int at_flags, enum bfs_ * Wrapper for the statx() system call, which had no glibc wrapper prior to 2.28. */ static int bfs_statx(int at_fd, const char *at_path, int at_flags, unsigned int mask, struct statx *buf) { + // -fsanitize=memory doesn't know about statx(), so tell it the memory + // got initialized +#if BFS_HAS_FEATURE(memory_sanitizer, false) + memset(buf, 0, sizeof(*buf)); +#endif + #if HAVE_STATX return statx(at_fd, at_path, at_flags, mask, buf); #else -- cgit v1.2.3