Package: psmisc
Version: 23.7-2
Followup-For: Bug #1122571

Hi Craig,

thanks for the quick feedback. I could not reproduce with any other
combination and suspected it must be due to that specific parameter's
positional handling. I've had a look now and sure enough, it's a
classic:

https://github.com/acg/psmisc/blob/master/src/killall.c#L824C1-L829C8

case 'V':
 /* option check is optind-1 but sig name is optind */
 if (strcmp(argv[optind-1],"-V") == 0 || strncmp(argv[optind-1],"--",2) == 0) {
    print_version();
    return 0;
 }

The second strncmp does it since at this time and with the given opt
string, getopt would have advanced its internal pointer. Assuming
argv[optind-1] still holds the token is generally the wrong approach to
sort out whether short or long option is present.

- Oliver

Reply via email to