mirror of
https://github.com/sheumann/hush.git
synced 2024-12-27 01:32:08 +00:00
fix recognitions of -SIGname signals
(fix by Jacques LUDER <jacques.luder@thalesgroup.com>)
This commit is contained in:
parent
8f6c79240d
commit
2a813e20e2
@ -15,7 +15,8 @@ static const struct signal_name {
|
|||||||
} signals[] = {
|
} signals[] = {
|
||||||
// SUSv3 says kill must support these, and specifies the numerical values,
|
// SUSv3 says kill must support these, and specifies the numerical values,
|
||||||
// http://www.opengroup.org/onlinepubs/009695399/utilities/kill.html
|
// http://www.opengroup.org/onlinepubs/009695399/utilities/kill.html
|
||||||
{0, "0"}, {1, "HUP"}, {2, "INT"}, {3, "QUIT"}, {6, "ABRT"}, {9, "KILL"},
|
// TODO: "[SIG]EXIT" shouldn't work for kill, right?
|
||||||
|
{0, "EXIT"}, {1, "HUP"}, {2, "INT"}, {3, "QUIT"}, {6, "ABRT"}, {9, "KILL"},
|
||||||
{14, "ALRM"}, {15, "TERM"},
|
{14, "ALRM"}, {15, "TERM"},
|
||||||
// And Posix adds the following:
|
// And Posix adds the following:
|
||||||
{SIGILL, "ILL"}, {SIGTRAP, "TRAP"}, {SIGFPE, "FPE"}, {SIGUSR1, "USR1"},
|
{SIGILL, "ILL"}, {SIGTRAP, "TRAP"}, {SIGFPE, "FPE"}, {SIGUSR1, "USR1"},
|
||||||
@ -30,12 +31,12 @@ int get_signum(const char *name)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
i = atoi(name);
|
i = bb_strtou(name, NULL, 10);
|
||||||
if (i) return i;
|
if (!errno) return i;
|
||||||
for (i = 0; i < sizeof(signals) / sizeof(struct signal_name); i++)
|
for (i = 0; i < sizeof(signals) / sizeof(struct signal_name); i++)
|
||||||
if (!strcasecmp(signals[i].name, name) ||
|
if (strcasecmp(name, signals[i].name) == 0
|
||||||
(!strncasecmp(signals[i].name, "SIG", 3)
|
|| (strncasecmp(name, "SIG", 3) == 0
|
||||||
&& !strcasecmp(signals[i].name+3, signals[i].name)))
|
&& strcasecmp(&name[3], signals[i].name) == 0))
|
||||||
return signals[i].number;
|
return signals[i].number;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,8 @@ int fuser_main(int argc, char **argv)
|
|||||||
optn = fuser_option(argv[i]);
|
optn = fuser_option(argv[i]);
|
||||||
if(optn) opt |= optn;
|
if(optn) opt |= optn;
|
||||||
else if(argv[i][0] == '-') {
|
else if(argv[i][0] == '-') {
|
||||||
if(0>(killsig = get_signum(argv[i]+1)))
|
killsig = get_signum(argv[i]+1);
|
||||||
|
if(0 > killsig)
|
||||||
killsig = SIGTERM;
|
killsig = SIGTERM;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user