From 54a61d76a6ae7592d384a64d34666c3f74724b0c Mon Sep 17 00:00:00 2001 From: wimpunk Date: Fri, 8 Feb 2008 10:08:24 +0000 Subject: [PATCH] Added mail-on-kill patch to patches section git-svn-id: svn+ssh://svn.code.sf.net/p/ddclient/code/trunk/svn@84 3873ddee-7413-0410-b6c4-c2c57c1ab35a --- patches/mail-on-kill.patch | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 patches/mail-on-kill.patch diff --git a/patches/mail-on-kill.patch b/patches/mail-on-kill.patch new file mode 100644 index 0000000..dd38ada --- /dev/null +++ b/patches/mail-on-kill.patch @@ -0,0 +1,44 @@ +# +# patch created with `svn diff -r82 . > patches/mail-on-kill.patch` +# on Fri Feb 8 11:03:01 CET 2008 +# applied on r82 +# +# This patch prevent ddclient sending out mail when interrupted by +# a TERM signal. It still sends mail ended by a KILL signal. +# +Index: ddclient +=================================================================== +--- ddclient (revision 82) ++++ ddclient (working copy) +@@ -602,8 +602,10 @@ + } + my $caught_hup = 0; + my $caught_term = 0; ++my $caught_kill = 0; + $SIG{'HUP'} = sub { $caught_hup = 1; }; + $SIG{'TERM'} = sub { $caught_term = 1; }; ++$SIG{'KILL'} = sub { $caught_kill = 1; }; + if (opt('daemon') && !opt('force')) { + $SIG{'CHLD'} = 'IGNORE'; + my $pid = fork; +@@ -665,7 +667,7 @@ + sendmail(); + + my $left = $daemon; +- while (($left > 0) && !$caught_hup && !$caught_term) { ++ while (($left > 0) && !$caught_hup && !$caught_term && !$caught_kill) { + my $delay = $left > 10 ? 10 : $left; + + $0 = sprintf("%s - sleeping for %s seconds", $program, $left); +@@ -681,9 +683,9 @@ + } else { + $result = $result eq 'OK' ? 0 : 1; + } +-} while ($daemon && !$result && !$caught_term); ++} while ($daemon && !$result && !$caught_term && !$caught_kill); + +-warning("caught SIGTERM; exiting") if $caught_term; ++warning("caught SIGKILL; exiting") if $caught_kill; + unlink_pid(); + sendmail(); +