stat-util: add new macros for declaring statx variable

Let's deal with the msan initialization issue once for all cases instead
of over and over again.
This commit is contained in:
Lennart Poettering
2020-09-03 15:02:16 +02:00
parent 86e443de2f
commit 7cd296c28f
4 changed files with 26 additions and 34 deletions
+19
View File
@@ -91,3 +91,22 @@ int device_path_parse_major_minor(const char *path, mode_t *ret_mode, dev_t *ret
int proc_mounted(void);
bool stat_inode_unmodified(const struct stat *a, const struct stat *b);
#if HAS_FEATURE_MEMORY_SANITIZER
# warning "Explicitly initializing struct statx, to work around msan limitation. Please remove as soon as msan has been updated to not require this."
# define STRUCT_STATX_DEFINE(var) \
struct statx var = {}
# define STRUCT_NEW_STATX_DEFINE(var) \
union { \
struct statx sx; \
struct new_statx nsx; \
} var = {}
#else
# define STRUCT_STATX_DEFINE(var) \
struct statx var
# define STRUCT_NEW_STATX_DEFINE(var) \
union { \
struct statx sx; \
struct new_statx nsx; \
} var
#endif