summaryrefslogtreecommitdiff
path: root/Echolot
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2003-04-29 18:15:37 +0000
committerPeter Palfrader <peter@palfrader.org>2003-04-29 18:15:37 +0000
commit5eae261e7247260f816137451e27886c76288112 (patch)
treeb0fbd388e2ce5a08a2479c244174619ae0336df5 /Echolot
parent502214f6a39a2b9af6111ce388b75c2d7448f4ad (diff)
fork() for calling mixmaster, so we can exec() it rather can using open("| ...") which ivokes a shell.
Diffstat (limited to 'Echolot')
-rw-r--r--Echolot/Pinger/Mix.pm22
1 files changed, 15 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;
};