Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 664066
Collapse All | Expand All

(-)psmisc-23.2.orig/src/killall.c (-12 / +25 lines)
Lines 350-357 Link Here
350
    lencomm = endcomm - startcomm;
350
    lencomm = endcomm - startcomm;
351
    if (lencomm < 0)
351
    if (lencomm < 0)
352
        lencomm = 0;
352
        lencomm = 0;
353
    if (lencomm > sizeof comm -1)
353
    if (lencomm > COMM_LEN -1)
354
        lencomm = sizeof comm -1;
354
        lencomm = COMM_LEN -1;
355
    strncpy(comm, startcomm, lencomm);
355
    strncpy(comm, startcomm, lencomm);
356
    comm[lencomm] = '\0';
356
    comm[lencomm] = '\0';
357
357
Lines 857-865 Link Here
857
857
858
    opterr = 0;
858
    opterr = 0;
859
#ifdef WITH_SELINUX
859
#ifdef WITH_SELINUX
860
    while ( (optc = getopt_long(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) {
860
    while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwZ:VIn:",options,NULL)) != -1) {
861
#else
861
#else
862
        while ( (optc = getopt_long(argc,argv,"egy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) {
862
        while ( (optc = getopt_long_only(argc,argv,"egy:o:ilqrs:u:vwVIn:",options,NULL)) != -1) {
863
#endif
863
#endif
864
            switch (optc) {
864
            switch (optc) {
865
            case 'e':
865
            case 'e':
Lines 914-920 Link Here
914
                    ignore_case = 1;
914
                    ignore_case = 1;
915
                } else {
915
                } else {
916
                    sig_num = get_signal (argv[optind]+1, "killall");
916
                    sig_num = get_signal (argv[optind]+1, "killall");
917
                    skip_error=1;
917
                    skip_error=optind;
918
                }
918
                }
919
                break;
919
                break;
920
            case 'V':
920
            case 'V':
Lines 922-934 Link Here
922
                if (strcmp(argv[optind-1],"-V") == 0 || strncmp(argv[optind-1],"--",2) == 0) {
922
                if (strcmp(argv[optind-1],"-V") == 0 || strncmp(argv[optind-1],"--",2) == 0) {
923
                    print_version();
923
                    print_version();
924
                    return 0;
924
                    return 0;
925
                } else {
926
                    sig_num = get_signal (argv[optind]+1, "killall");
927
                    skip_error=optind;
925
                }
928
                }
926
                sig_num = get_signal (argv[optind]+1, "killall");
927
                break;
929
                break;
928
            case 'n':
930
            case 'n': {
929
                opt_ns_pid = atoi(optarg);
931
                long num;
930
                if (opt_ns_pid == 0)
932
                char *end = NULL;
933
                errno = 0;
934
                num = strtol(optarg, &end, 10);
935
                if (errno != 0 || optarg == end || end == NULL)
931
                    usage(_("Invalid namespace PID"));
936
                    usage(_("Invalid namespace PID"));
937
                opt_ns_pid = (pid_t) num;
938
            }
932
                break;
939
                break;
933
#ifdef WITH_SELINUX
940
#ifdef WITH_SELINUX
934
            case 'Z': 
941
            case 'Z': 
Lines 943-948 Link Here
943
                break;
950
                break;
944
#endif /*WITH_SELINUX*/
951
#endif /*WITH_SELINUX*/
945
            case '?':
952
            case '?':
953
                if (skip_error == optind)
954
                    break;
955
                /* Sigh, this is a hack because -ve could be -version or
956
                 * -verbose */
957
                if (strncmp(argv[optind-1], "-ve", 3) == 0) {
958
                    verbose=1;
959
                    exact=1;
960
                    break;
961
                }
946
                /* Signal names are in uppercase, so check to see if the argv
962
                /* Signal names are in uppercase, so check to see if the argv
947
                 * is upper case */
963
                 * is upper case */
948
                if (argv[optind-1][1] >= 'A' && argv[optind-1][1] <= 'Z') {
964
                if (argv[optind-1][1] >= 'A' && argv[optind-1][1] <= 'Z') {
Lines 952-960 Link Here
952
                    if (argv[optind-1][1] >= '0' && argv[optind-1][1] <= '9') {
968
                    if (argv[optind-1][1] >= '0' && argv[optind-1][1] <= '9') {
953
                        sig_num = atoi(argv[optind-1]+1);
969
                        sig_num = atoi(argv[optind-1]+1);
954
                    } else {
970
                    } else {
955
                        if (skip_error)
956
                            skip_error=0;
957
                        else
958
                            usage(NULL);
971
                            usage(NULL);
959
                    }
972
                    }
960
                }
973
                }

Return to bug 664066