Don't attempt to catch the uncatchable SIGKILL signal
This commit is contained in:
parent
7a9991966b
commit
fb67669902
1 changed files with 2 additions and 5 deletions
7
ddclient
7
ddclient
|
@ -834,10 +834,8 @@ if (!opt('daemon') && $programd =~ /d$/) {
|
||||||
}
|
}
|
||||||
my $caught_hup = 0;
|
my $caught_hup = 0;
|
||||||
my $caught_term = 0;
|
my $caught_term = 0;
|
||||||
my $caught_kill = 0;
|
|
||||||
$SIG{'HUP'} = sub { $caught_hup = 1; };
|
$SIG{'HUP'} = sub { $caught_hup = 1; };
|
||||||
$SIG{'TERM'} = sub { $caught_term = 1; };
|
$SIG{'TERM'} = sub { $caught_term = 1; };
|
||||||
$SIG{'KILL'} = sub { $caught_kill = 1; };
|
|
||||||
# don't fork() if foreground or force is on
|
# don't fork() if foreground or force is on
|
||||||
if (opt('foreground') || opt('force')) {
|
if (opt('foreground') || opt('force')) {
|
||||||
;
|
;
|
||||||
|
@ -893,7 +891,7 @@ do {
|
||||||
sendmail();
|
sendmail();
|
||||||
|
|
||||||
my $left = $daemon;
|
my $left = $daemon;
|
||||||
while (($left > 0) && !$caught_hup && !$caught_term && !$caught_kill) {
|
while (($left > 0) && !$caught_hup && !$caught_term) {
|
||||||
my $delay = $left > 10 ? 10 : $left;
|
my $delay = $left > 10 ? 10 : $left;
|
||||||
|
|
||||||
$0 = sprintf("%s - sleeping for %s seconds", $program, $left);
|
$0 = sprintf("%s - sleeping for %s seconds", $program, $left);
|
||||||
|
@ -913,9 +911,8 @@ do {
|
||||||
} else {
|
} else {
|
||||||
$result = $result eq 'OK' ? 0 : 1;
|
$result = $result eq 'OK' ? 0 : 1;
|
||||||
}
|
}
|
||||||
} while ($daemon && !$result && !$caught_term && !$caught_kill);
|
} while ($daemon && !$result && !$caught_term);
|
||||||
|
|
||||||
warning("caught SIGKILL; exiting") if $caught_kill;
|
|
||||||
unlink_pid();
|
unlink_pid();
|
||||||
sendmail();
|
sendmail();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue