]> www.infradead.org Git - users/jedix/linux-maple.git/commit
selftests/bpf: Use portable POSIX basename()
authorTony Ambardar <tony.ambardar@gmail.com>
Mon, 29 Jul 2024 09:24:17 +0000 (02:24 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 30 Jul 2024 20:45:44 +0000 (13:45 -0700)
commitc0247800ee7da5bc067b2916cf2722f755072307
tree1ded00f4789bc6d6ea07cfea2fd9be5860f710b6
parent781f0bbbdade00f91490a3f64212e8cc8d75905c
selftests/bpf: Use portable POSIX basename()

Use the POSIX version of basename() to allow compilation against non-gnu
libc (e.g. musl). Include <libgen.h> ahead of <string.h> to enable using
functions from the latter while preferring POSIX over GNU basename().

In veristat.c, rely on strdupa() to avoid basename() altering the passed
"const char" argument. This is not needed in xskxceiver.c since the arg
is mutable and the program exits immediately after usage.

Signed-off-by: Tony Ambardar <tony.ambardar@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/0fd3c9f3c605e6cba33504213c9df287817ade04.1722244708.git.tony.ambardar@gmail.com
tools/testing/selftests/bpf/veristat.c
tools/testing/selftests/bpf/xskxceiver.c