summaryrefslogtreecommitdiffstats
path: root/stat.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-02-01 12:57:00 -0500
committerTavian Barnes <tavianator@tavianator.com>2019-02-01 12:57:00 -0500
commit3a52c0e1f55d5dd03a00740c191569b9309c0ad6 (patch)
tree65785e4e2e4ff1a0a5ed4ec2f46895d559333616 /stat.c
parent23b55d03ddf69b5ab40dc338c419089e8c64930b (diff)
parent36330d7aab63ef2c202efb0d551f104ed6cefa17 (diff)
downloadbfs-3a52c0e1f55d5dd03a00740c191569b9309c0ad6.tar.xz
Merge branch 'improvements'
Diffstat (limited to 'stat.c')
-rw-r--r--stat.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/stat.c b/stat.c
index 47585b8..d223ff8 100644
--- a/stat.c
+++ b/stat.c
@@ -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