From 606cf3a3f7230f15caa4220e49cfbfae8ec00615 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 15 Jun 2004 17:41:41 +0000 Subject: Do not call syswrite if we have nothing to write --- Echolot/Tools.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Echolot') diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm index 018f958..956b93c 100644 --- a/Echolot/Tools.pm +++ b/Echolot/Tools.pm @@ -317,14 +317,17 @@ sub readwrite_gpg($$$$$) { my ($stdout, $stderr, $status) = ("", "", ""); - my ($readyr, $readyw, $written); + my ($readyr, $readyw); while ($sout->count() > 0 || (defined($sin) && ($sin->count() > 0))) { Echolot::Log::trace("select waiting for ".($sout->count())." fds."); ($readyr, $readyw, undef) = IO::Select::select($sout, $sin, undef, 42); Echolot::Log::trace("ready: write: ".(scalar @$readyw)."; read: ".(scalar @$readyr)); for my $wfd (@$readyw) { Echolot::Log::trace("writing to $wfd."); - $written = $wfd->syswrite($in, length($in) - $offset, $offset); + my $written = 0; + if ($offset != length($in)) { + $written = $wfd->syswrite($in, length($in) - $offset, $offset); + } unless (defined ($written)) { Echolot::Log::warn("Error while writing to GnuPG: $!"); close $wfd; -- cgit v1.2.3