diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2019-01-31 23:50:25 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2019-01-31 23:54:36 -0500 |
commit | 185026706d926d1f94bd1c42a11dd83e6b8e74ec (patch) | |
tree | 0187871a790e35d80b5bf66fed497ecc9286399c /stat.c | |
parent | deef4028ecd70d5b0006b83da07d170c38efb3aa (diff) | |
download | bfs-185026706d926d1f94bd1c42a11dd83e6b8e74ec.tar.xz |
stat: Work around msan not knowing about statx()
Diffstat (limited to 'stat.c')
-rw-r--r-- | stat.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -20,6 +20,7 @@ #include <errno.h> #include <fcntl.h> #include <stdbool.h> +#include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> @@ -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 |