From: Ioana Ciornei Date: Wed, 9 Jan 2019 17:06:55 +0000 (+0000) Subject: samples: bpf: user proper argument index X-Git-Tag: v5.15~7163^2~7^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11b36abc249f5e100d532c5271dae938fde85175;p=platform%2Fkernel%2Flinux-starfive.git samples: bpf: user proper argument index Use optind as index for argv instead of a hardcoded value. When the program has options this leads to improper parameter handling. Fixes: dc378a1ab5b6 ("samples: bpf: get ifindex from ifname") Signed-off-by: Ioana Ciornei Acked-by: Matteo Croce Signed-off-by: Daniel Borkmann --- diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c index 0a197f8..8bfda95 100644 --- a/samples/bpf/xdp1_user.c +++ b/samples/bpf/xdp1_user.c @@ -103,7 +103,7 @@ int main(int argc, char **argv) return 1; } - ifindex = if_nametoindex(argv[1]); + ifindex = if_nametoindex(argv[optind]); if (!ifindex) { perror("if_nametoindex"); return 1;