You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by km...@apache.org on 2011/09/01 00:33:25 UTC

svn commit: r1163848 - in /spamassassin/trunk: lib/Mail/SpamAssassin/Util.pm sa-update.raw

Author: kmcgrail
Date: Wed Aug 31 22:33:25 2011
New Revision: 1163848

URL: http://svn.apache.org/viewvc?rev=1163848&view=rev
Log:
Michaels patch for more error trapping on sa-update.  See bug 6655

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
    spamassassin/trunk/sa-update.raw

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm?rev=1163848&r1=1163847&r2=1163848&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm Wed Aug 31 22:33:25 2011
@@ -1057,6 +1057,8 @@ sub secure_tmpfile {
     return;
   }
 
+  opendir(my $dh, $tmpdir) || die "Could not open $tmpdir: $!";
+  closedir $dh;
   my ($reportfile, $tmpfile);
   my $umask = umask 077;
 
@@ -1084,7 +1086,10 @@ sub secure_tmpfile {
 
     # ensure the file handle is not semi-open in some way
     if ($tmpfile) {
-      close $tmpfile  or info("error closing $reportfile: $!");
+      if (! close $tmpfile) {
+       info("error closing $reportfile: $!");
+       $tmpfile=undef;
+      }
     }
   }
 

Modified: spamassassin/trunk/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-update.raw?rev=1163848&r1=1163847&r2=1163848&view=diff
==============================================================================
--- spamassassin/trunk/sa-update.raw (original)
+++ spamassassin/trunk/sa-update.raw Wed Aug 31 22:33:25 2011
@@ -683,9 +683,9 @@ foreach my $channel (@channels) {
 
   # Write the content out to a temp file for GPG/Archive::Tar interaction
   dbg("channel: populating temp content file");
-  open(TMP, ">$content_file") || die "fatal: can't write to content temp file $content_file: $!\n";
+  open(TMP, ">$content_file") || die "fatal: couldn't create content temp file $content_file: $!\n";
   binmode TMP;
-  print TMP $content;
+  print TMP $content || die "fatal: can't write to content temp file $content_file: $!\n";
   close(TMP);
 
   # to sign  : gpg -bas file
@@ -701,7 +701,7 @@ foreach my $channel (@channels) {
       die "fatal: couldn't create temp file for GPG signature: $!\n";
     }
     binmode $tfh;
-    print $tfh $GPG;
+    print $tfh $GPG || die "fatal: can't write temp file for GPG signature: $!\n";
     close($tfh);
 
     dbg("gpg: calling gpg");