selftests/bpf: xdp_hw_metadata correct status value in error(3)
authorJesper Dangaard Brouer <brouer@redhat.com>
Wed, 1 Feb 2023 17:32:00 +0000 (18:32 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 1 Feb 2023 23:48:49 +0000 (00:48 +0100)
commit7bd4224deecd2d917fcbb52f9d13ab1453be219a
treed1d9cfdf7de2f2e19a653634ee0b331110ddcb86
parenta19a62e56478ba4afadfa7df94d0819542b7ccf8
selftests/bpf: xdp_hw_metadata correct status value in error(3)

The glibc error reporting function error():

 void error(int status, int errnum, const char *format, ...);

The status argument should be a positive value between 0-255 as it
is passed over to the exit(3) function as the value as the shell exit
status. The least significant byte of status (i.e., status & 0xFF) is
returned to the shell parent.

Fix this by using 1 instead of -1. As 1 corresponds to C standard
constant EXIT_FAILURE.

Fixes: 297a3f124155 ("selftests/bpf: Simple program to dump XDP RX metadata")
Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/167527272038.937063.9137108142012298120.stgit@firesoul
tools/testing/selftests/bpf/xdp_hw_metadata.c