abuild-tar: improve invalid opt handling

make sure we always print usage help text if we have an invalid option.

fixes https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10101
This commit is contained in:
Natanael Copa 2023-04-17 13:01:05 +02:00
parent 2d446f094c
commit 6ef57910ab
1 changed files with 4 additions and 1 deletions

View File

@ -385,7 +385,10 @@ int main(int argc, char **argv)
ENGINE_register_all_complete();
#endif
while (getopt_long(argc, argv, "", options, &ndx) != -1) {
int c;
while ((c = getopt_long(argc, argv, "", options, &ndx)) != -1) {
if (c == '?')
return usage(stderr);
if (ndx == 0)
digest = optarg ? optarg : "sha1";
}