diff options
author | Christian Brauner <brauner@kernel.org> | 2025-02-04 12:27:48 +0100 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2025-02-12 12:12:27 +0100 |
commit | a496dfecbc47253012f1e10d01110428bb9dc118 (patch) | |
tree | 82b35b304b1f155f82265b47b610adb174aeaa95 /samples | |
parent | 37c4a9590e1efcae7749682239fc22a330d2d325 (diff) |
samples/vfs: check whether flag was raised
For string options the kernel will raise the corresponding flag only if
the string isn't empty. So check for the flag.
Link: https://lore.kernel.org/r/20250204-work-mnt_idmap-statmount-v2-3-007720f39f2e@kernel.org
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'samples')
-rw-r--r-- | samples/vfs/test-list-all-mounts.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/samples/vfs/test-list-all-mounts.c b/samples/vfs/test-list-all-mounts.c index 1a02ea4593e3..ce272ded8a79 100644 --- a/samples/vfs/test-list-all-mounts.c +++ b/samples/vfs/test-list-all-mounts.c @@ -138,10 +138,11 @@ next: printf("mnt_id:\t\t%" PRIu64 "\nmnt_parent_id:\t%" PRIu64 "\nfs_type:\t%s\nmnt_root:\t%s\nmnt_point:\t%s\nmnt_opts:\t%s\n\n", (uint64_t)stmnt->mnt_id, (uint64_t)stmnt->mnt_parent_id, - stmnt->str + stmnt->fs_type, - stmnt->str + stmnt->mnt_root, - stmnt->str + stmnt->mnt_point, - stmnt->str + stmnt->mnt_opts); + (stmnt->mask & STATMOUNT_FS_TYPE) ? stmnt->str + stmnt->fs_type : "", + (stmnt->mask & STATMOUNT_MNT_ROOT) ? stmnt->str + stmnt->mnt_root : "", + (stmnt->mask & STATMOUNT_MNT_POINT) ? stmnt->str + stmnt->mnt_point : "", + (stmnt->mask & STATMOUNT_MNT_OPTS) ? stmnt->str + stmnt->mnt_opts : ""); + free(stmnt); } } |