diff --git a/ctf_loader.c b/ctf_loader.c index 17af2c8..46101ae 100644 --- a/ctf_loader.c +++ b/ctf_loader.c @@ -788,13 +788,15 @@ static void open_files(struct ctf_state *sp, const char *in_filename) } } -int ctf__load(struct cus *self, struct argp *argp __unused, - int argc, char *argv[]) +int ctf__load(struct cus *self, struct argp *argp, int argc, char *argv[]) { struct ctf_state state; memset(&state, 0, sizeof(state)); + if (argc > 2 && argp_parse(argp, argc - 1, argv, 0, NULL, NULL)) + return -1; + open_files(&state, argv[argc - 1]); if (elf_version(EV_CURRENT) == EV_NONE) { diff --git a/pahole.c b/pahole.c index 88cb272..71af70c 100644 --- a/pahole.c +++ b/pahole.c @@ -891,7 +891,10 @@ static error_t pahole__options_parser(int key, char *arg, struct argp_state *state) { switch (key) { - case ARGP_KEY_INIT: state->child_inputs[0] = state->input; break; + case ARGP_KEY_INIT: + if (state->child_inputs != NULL) + state->child_inputs[0] = state->input; + break; case 'A': class__include_nested_anonymous = 1; break; case 'a': class__include_anonymous = 1; break; case 'B': nr_bit_holes = atoi(arg); break;