diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-09-01 18:24:44 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-09-03 15:02:16 +0200 |
commit | 7cd296c28fa81b9be976757397556bdb51afaf78 (patch) | |
tree | 841f6263f1def1fee4285926a060322ccad68d62 /src/basic/mountpoint-util.c | |
parent | 86e443de2fd3b0bac785015358c52130e89b66f1 (diff) | |
download | systemd-7cd296c28fa81b9be976757397556bdb51afaf78.tar.gz |
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.
Diffstat (limited to 'src/basic/mountpoint-util.c')
-rw-r--r-- | src/basic/mountpoint-util.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/basic/mountpoint-util.c b/src/basic/mountpoint-util.c index 2ad27ce830..681da74024 100644 --- a/src/basic/mountpoint-util.c +++ b/src/basic/mountpoint-util.c @@ -13,6 +13,7 @@ #include "mountpoint-util.h" #include "parse-util.h" #include "path-util.h" +#include "stat-util.h" #include "stdio-util.h" #include "strv.h" @@ -135,13 +136,8 @@ int fd_is_mount_point(int fd, const char *filename, int flags) { _cleanup_free_ struct file_handle *h = NULL, *h_parent = NULL; int mount_id = -1, mount_id_parent = -1; bool nosupp = false, check_st_dev = true; + STRUCT_STATX_DEFINE(sx); struct stat a, b; - struct statx sx -#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." -#endif - ; int r; assert(fd >= 0); @@ -298,15 +294,7 @@ int path_is_mount_point(const char *t, const char *root, int flags) { } int path_get_mnt_id(const char *path, int *ret) { - union { - struct statx sx; - struct new_statx nsx; - } buf -#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." -#endif - ; + STRUCT_NEW_STATX_DEFINE(buf); int r; if (statx(AT_FDCWD, path, AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_MNT_ID, &buf.sx) < 0) { |