Skip to content

Commit 33cec19

Browse files
arndbbrauner
authored andcommitted
samples/vfs: fix printf format string for size_t
size_t needs a %z format string modifier instead of %l samples/vfs/test-list-all-mounts.c:152:39: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat] 152 | printf("mnt_uidmap[%lu]:\t%s\n", idx, idmap); | ~~~ ^~~ | %zu samples/vfs/test-list-all-mounts.c:161:39: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Wformat] 161 | printf("mnt_gidmap[%lu]:\t%s\n", idx, idmap); | ~~~ ^~~ | %zu Fixes: fa204a6 ("samples/vfs: add STATMOUNT_MNT_{G,U}IDMAP") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20250224141406.1400864-1-arnd@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 7a54947 commit 33cec19

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

samples/vfs/test-list-all-mounts.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
149149
const char *idmap = stmnt->str + stmnt->mnt_uidmap;
150150

151151
for (size_t idx = 0; idx < stmnt->mnt_uidmap_num; idx++) {
152-
printf("mnt_uidmap[%lu]:\t%s\n", idx, idmap);
152+
printf("mnt_uidmap[%zu]:\t%s\n", idx, idmap);
153153
idmap += strlen(idmap) + 1;
154154
}
155155
}
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
158158
const char *idmap = stmnt->str + stmnt->mnt_gidmap;
159159

160160
for (size_t idx = 0; idx < stmnt->mnt_gidmap_num; idx++) {
161-
printf("mnt_gidmap[%lu]:\t%s\n", idx, idmap);
161+
printf("mnt_gidmap[%zu]:\t%s\n", idx, idmap);
162162
idmap += strlen(idmap) + 1;
163163
}
164164
}

0 commit comments

Comments
 (0)