Skip to content
  • Filipe Brandenburger's avatar
    pkill: reject -signal number with trailing garbage · 9646f7cb
    Filipe Brandenburger authored
    
    
    This commit prevents pkill from accepting something like `-1garbage` as
    a SIGHUP. The previous code was using atoi() which does not check for
    trailing garbage and would parse the above as 1.
    
    Handling numeric signals in signal_option() is not really necessary,
    since signal_name_to_number() will recognize numeric signals and parse
    them properly using strtol() and checking for trailing garbage. It also
    checks that the numeric signals are in the proper range. So all we need
    to do is remove the buggy numeric signal handling here.
    
    Tested with `pkill -1garbage sleep`, after this patch it will complain
    that "1" is not a valid option, which is the expected.
    
    Signed-off-by: default avatarFilipe Brandenburger <filbranden@google.com>
    9646f7cb