summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Echolot/Tools.pm9
1 files changed, 6 insertions, 3 deletions
diff --git a/Echolot/Tools.pm b/Echolot/Tools.pm
index d1a10a2..425180c 100644
--- a/Echolot/Tools.pm
+++ b/Echolot/Tools.pm
@@ -325,9 +325,12 @@ sub readwrite_gpg($$$$$) {
for my $wfd (@$readyw) {
Echolot::Log::trace("writing to $wfd.");
$written = $wfd->syswrite($in, length($in) - $offset, $offset);
- defined ($written) or
- Echolot::Log::warn("Error while writing to GnuPG: $!"),
- next;
+ unless (defined ($written)) {
+ Echolot::Log::warn("Error while writing to GnuPG: $!");
+ close $wfd;
+ $sin->remove($wfd);
+ $sin = undef;
+ };
$offset += $written;
if ($offset == length($in)) {
Echolot::Log::trace("writing to $wfd done.");