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 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'Echolot') 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; }; -- cgit v1.2.3