From e8683a54e9a204e92db3823b228fb8308f6b3a61 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Mon, 14 Jun 2004 16:59:46 +0000 Subject: Fix that check for syswrite's return value --- Echolot/Tools.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Echolot') 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."); -- cgit v1.2.3