Commit
4359cf069819d9fb53493933e00d9af5c37bced5 restored kill's ability
to kill PID -1. This however left PIDs -2 to -9 (or rather process
groups 2 to 9) still having this problem. The check is now generically
looking for a digit and parses it correctly.
if (i == -1)
goto closure;
}
- read(fd, buf, 128);
+ if (read(fd, buf, 128) <= 0)
+ goto closure;
buf[127] = '\0';
tmp = strrchr(buf, ')');
*tmp++ = '\0';
display_kill_version();
exit(EXIT_SUCCESS);
case '?':
- /* Special case is -1 which means all except init */
- if (optopt == '1') {
- if (kill(-1, signo) != 0)
- exitvalue = EXIT_FAILURE;
- exit(exitvalue);
- }
if (!isdigit(optopt)) {
xwarnx(_("invalid argument %c"), optopt);
kill_usage(stderr);
+ } else {
+ /* Special case for signal digit negative
+ * PIDs */
+ pid = (long)('0' - optopt);
+ if (kill((pid_t)pid, signo) != 0)
+ exitvalue = EXIT_FAILURE;
+ exit(exitvalue);
}
loop=0;
break;