diff options
author | Peter Palfrader <peter@palfrader.org> | 2004-06-15 17:41:41 +0000 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2004-06-15 17:41:41 +0000 |
commit | 606cf3a3f7230f15caa4220e49cfbfae8ec00615 (patch) | |
tree | f5fb1a762ff7824bcb44252edb01529c502820f8 /Echolot | |
parent | fb251b65079b0545417fc8c351d6caeb0e096263 (diff) |
Do not call syswrite if we have nothing to write
Diffstat (limited to 'Echolot')
-rw-r--r-- | Echolot/Tools.pm | 7 |
1 files changed, 5 insertions, 2 deletions
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; |