提交 11b36abc 编写于 作者: I Ioana Ciornei 提交者: Daniel Borkmann

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: dc378a1a ("samples: bpf: get ifindex from ifname")
Signed-off-by: NIoana Ciornei <ioana.ciornei@nxp.com>
Acked-by: NMatteo Croce <mcroce@redhat.com>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
上级 e3ca63de
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册