From 5eae261e7247260f816137451e27886c76288112 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 29 Apr 2003 18:15:37 +0000 Subject: fork() for calling mixmaster, so we can exec() it rather can using open("| ...") which ivokes a shell. --- Echolot/Pinger/Mix.pm | 22 +++++++++++++++------- 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 -# $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; }; diff --git a/NEWS b/NEWS index fa38859..1e82219 100644 --- a/NEWS +++ b/NEWS @@ -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. -- cgit v1.2.3