summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/config.h9
-rw-r--r--src/parse.c6
2 files changed, 12 insertions, 3 deletions
diff --git a/src/config.h b/src/config.h
index 229f593..810f913 100644
--- a/src/config.h
+++ b/src/config.h
@@ -213,4 +213,13 @@
# define BFS_UNSUPPRESS()
#endif
+/**
+ * Initialize a variable, unless sanitizers would detect uninitialized uses.
+ */
+#if __has_feature(memory_sanitizer)
+# define BFS_UNINIT(var, value) var = var
+#else
+# define BFS_UNINIT(var, value) var = value
+#endif
+
#endif // BFS_CONFIG_H
diff --git a/src/parse.c b/src/parse.c
index 320e165..90e7e3b 100644
--- a/src/parse.c
+++ b/src/parse.c
@@ -2121,9 +2121,9 @@ static int parse_mode(const struct parser_state *state, const char *mode, struct
MODE_EQUALS,
} op;
- mode_t who;
- mode_t file_change;
- mode_t dir_change;
+ mode_t BFS_UNINIT(who, 0);
+ mode_t BFS_UNINIT(file_change, 0);
+ mode_t BFS_UNINIT(dir_change, 0);
const char *i = mode;
while (true) {