diff options
| author | Toke Høiland-Jørgensen <[email protected]> | 2019-12-19 09:02:36 +0000 |
|---|---|---|
| committer | Daniel Borkmann <[email protected]> | 2019-12-19 15:25:52 +0000 |
| commit | b5c7d0d0f7d4a30ae96c1350df677cb849060b7c (patch) | |
| tree | 975c0b1f3f3994d6d75065840ba80c6f52456efe /tools/lib/bpf/libbpf.c | |
| parent | selftests/bpf: Fix test_attach_probe (diff) | |
| download | kernel-b5c7d0d0f7d4a30ae96c1350df677cb849060b7c.tar.gz kernel-b5c7d0d0f7d4a30ae96c1350df677cb849060b7c.zip | |
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: dc3a2d254782 ("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]
Diffstat (limited to 'tools/lib/bpf/libbpf.c')
| -rw-r--r-- | tools/lib/bpf/libbpf.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 6340b81b555b..febbaac3daf4 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -117,7 +117,7 @@ static void pr_perm_msg(int err) return; if (limit.rlim_cur < 1024) - snprintf(buf, sizeof(buf), "%lu bytes", limit.rlim_cur); + snprintf(buf, sizeof(buf), "%zu bytes", (size_t)limit.rlim_cur); else if (limit.rlim_cur < 1024*1024) snprintf(buf, sizeof(buf), "%.1f KiB", (double)limit.rlim_cur / 1024); else |
