Skip to content

Commit b5c7d0d

Browse files
tohojoborkmann
authored andcommitted
libbpf: Fix printing of ulimit value
Naresh pointed out that libbpf builds fail on 32-bit architectures because rlimit.rlim_cur is defined as 'unsigned long long' on those architectures. Fix this by using %zu in printf and casting to size_t. Fixes: dc3a2d2 ("libbpf: Print hint about ulimit when getting permission denied error") Reported-by: Naresh Kamboju <[email protected]> Signed-off-by: Toke Høiland-Jørgensen <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 580205d commit b5c7d0d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/lib/bpf/libbpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static void pr_perm_msg(int err)
117117
return;
118118

119119
if (limit.rlim_cur < 1024)
120-
snprintf(buf, sizeof(buf), "%lu bytes", limit.rlim_cur);
120+
snprintf(buf, sizeof(buf), "%zu bytes", (size_t)limit.rlim_cur);
121121
else if (limit.rlim_cur < 1024*1024)
122122
snprintf(buf, sizeof(buf), "%.1f KiB", (double)limit.rlim_cur / 1024);
123123
else

0 commit comments

Comments
 (0)