diff options
author | Peter Palfrader <peter@palfrader.org> | 2003-04-29 18:15:37 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2003-04-29 18:15:37 +0000 |
commit | 5eae261e7247260f816137451e27886c76288112 (patch) | |
tree | b0fbd388e2ce5a08a2479c244174619ae0336df5 | |
parent | 502214f6a39a2b9af6111ce388b75c2d7448f4ad (diff) |
fork() for calling mixmaster, so we can exec() it rather can using open("| ...") which ivokes a shell.
-rw-r--r-- | Echolot/Pinger/Mix.pm | 22 | ||||
-rw-r--r-- | NEWS | 2 |
2 files changed, 17 insertions, 7 deletions
diff --git a/Echolot/Pinger/Mix.pm b/Echolot/Pinger/Mix.pm index f331f2a..1b774a2 100644 --- a/Echolot/Pinger/Mix.pm +++ b/Echolot/Pinger/Mix.pm @@ -1,7 +1,7 @@ package Echolot::Pinger::Mix; # (c) 2002 Peter Palfrader <peter@palfrader.org> -# $Id: Mix.pm,v 1.13 2003/02/17 14:44:15 weasel Exp $ +# $Id: Mix.pm,v 1.14 2003/04/29 18:15:37 weasel Exp $ # =pod @@ -66,14 +66,22 @@ sub ping($$$$$) { Echolot::Log::warn("Cannot close $mixcfg: $!."), return 0; - $ENV{'MIXPATH'} = Echolot::Config::get()->{'mixhome'}; - open(MIX, "|".Echolot::Config::get()->{'mixmaster'}." -m -S -l $chaincomma 2>/dev/null") or - Echolot::Log::warn("Cannot exec mixpinger: $!."), + my $pid = open(KID, "|-"); + defined $pid or + Echolot::Log::warn("Cannot fork for calling mixmaster: $!."), return 0; - print MIX "From: Echolot Pinger <$address>\n" + unless ($pid) { # child + $ENV{'MIXPATH'} = Echolot::Config::get()->{'mixhome'}; + { exec(Echolot::Config::get()->{'mixmaster'}, qw{-m -S -l}, $chaincomma); }; + Echolot::Log::warn("Cannot exec mixpinger: $!."); + exit(1); + }; + print KID "From: Echolot Pinger <$address>\n" if $with_from; - print MIX "To: $to\n\n$body\n"; - close (MIX); + print KID "To: $to\n\n$body\n"; + close (KID); + + waitpid $pid, 0; return 1; }; @@ -1,5 +1,7 @@ Changes in * Fix 0/false in Fetch/Ping/Show in summary report. + * fork() for calling mixmaster, so we can exec() it + rather can using open("| ...") which ivokes a shell. Changes in version * Minor documentation fixes suggested by Ryan Lackey. |