freebsd-ports/net-mgmt/smokeping/files/patch-lib_Smokeping.pm
Rodrigo Osorio d747416531 net-mgmt/smokeping: fix mail loop issue
Integrate upstream patch[1] to fix mail loop issue #183[2].

This is a one-line patch without complexity who can be removed
as soon as the upstream releases a new version.

[1] e9004e8bbe
[2] https://github.com/oetiker/SmokePing/issues/183

PR:		253161
Submitted by:	OlivierW <olivierw1+bugzilla-freebsd@hotmail.com>
2021-02-02 08:14:06 +00:00

47 lines
2.3 KiB
Perl

--- lib/Smokeping.pm.orig 2021-02-01 12:05:21 UTC
+++ lib/Smokeping.pm
@@ -1889,7 +1889,7 @@ sub check_alerts {
$gotalert = $match unless $gotalert;
my $edgetrigger = $alert->{edgetrigger} eq 'yes';
my $what;
- if ($edgetrigger and $prevmatch != $match) {
+ if ($edgetrigger and ($prevmatch ? 0 : 1 ) != ($match ? 0 : 1)) {
$what = ($prevmatch == 0 ? "was raised" : "was cleared");
}
if (not $edgetrigger and $match) {
@@ -4306,7 +4306,7 @@ sub main (;$) {
if(defined $opt{'check'}) { verify_cfg($cfgfile); exit 0; }
if($opt{reload}) {
load_cfg $cfgfile, 'noinit'; # we need just the piddir
- kill_smoke $cfg->{General}{piddir}."/smokeping.pid", SIGHUP;
+ kill_smoke $cfg->{General}{piddir}."/pid", SIGHUP;
print "HUP signal sent to the running SmokePing process, exiting.\n";
exit 0;
};
@@ -4315,7 +4315,7 @@ sub main (;$) {
if(defined $opt{'static-pages'}) { makestaticpages $cfg, $opt{'static-pages'}; exit 0 };
if($opt{email}) { enable_dynamic $cfg, $cfg->{Targets},"",""; exit 0 };
}
- if($opt{restart}) { kill_smoke $cfg->{General}{piddir}."/smokeping.pid", SIGINT;};
+ if($opt{restart}) { kill_smoke $cfg->{General}{piddir}."/pid", SIGINT;};
if($opt{logfile}) { initialize_filelog($opt{logfile}) };
@@ -4328,7 +4328,7 @@ sub main (;$) {
initialize_syslog($cfg->{General}{syslogfacility},
$cfg->{General}{syslogpriority});
}
- daemonize_me $cfg->{General}{piddir}."/smokeping.pid";
+ daemonize_me $cfg->{General}{piddir}."/pid";
}
do_log "Smokeping version $VERSION successfully launched.";
@@ -4514,7 +4514,7 @@ KID:
my $new_conf = Smokeping::Slave::submit_results $slave_cfg,$cfg,$myprobe,$probes;
if ($new_conf && !$gothup){
do_log('server has new config for me ... HUPing the parent');
- kill_smoke $cfg->{General}{piddir}."/smokeping.pid", SIGHUP;
+ kill_smoke $cfg->{General}{piddir}."/pid", SIGHUP;
# wait until the parent signals back if it didn't already
sleep if (!$gothup);
if (!$gothup) {