diff options
author | Connor O'Brien <connoro@google.com> | 2022-03-31 13:12:31 -0700 |
---|---|---|
committer | Connor O'Brien <connoro@google.com> | 2022-03-31 13:44:11 -0700 |
commit | c749a59d3318e5037ee1883e7b8b8fd0a2547fe7 (patch) | |
tree | 3494ddeb60f8fe7bf50267dd86afe005a02769b3 | |
parent | 991f7d3dd5ca2a774f3b5b34721664a50ea9ac7d (diff) | |
download | bcc-c749a59d3318e5037ee1883e7b8b8fd0a2547fe7.tar.gz |
libbpf-tools: fix arg_num field for positional arguments
vfsstat expects positional arguments to have arg_num starting from 0,
so update argp_parse accordingly
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Ifb78d13ce638bfb9ba3ec857864fbbbc92e5720f
-rw-r--r-- | libbpf-tools/android/argp.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libbpf-tools/android/argp.cpp b/libbpf-tools/android/argp.cpp index 5c39f79f..6c1b22fe 100644 --- a/libbpf-tools/android/argp.cpp +++ b/libbpf-tools/android/argp.cpp @@ -61,7 +61,7 @@ extern "C" error_t argp_parse(const struct argp *argp, int argc, char **argv, in // Handle positional arguments if (optind < argc) { for (int idx = optind; idx < argc; idx++) { - struct argp_state state = { .input = input, .argp = argp, .arg_num = idx }; + struct argp_state state = { .input = input, .argp = argp, .arg_num = idx - optind }; const error_t ret = argp->parser(ARGP_KEY_ARG, argv[idx], &state); if (ret) return ret; } |