You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/09/18 15:13:10 UTC

svn commit: r576895 - /spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm

Author: jm
Date: Tue Sep 18 06:13:09 2007
New Revision: 576895

URL: http://svn.apache.org/viewvc?rev=576895&view=rev
Log:
bug 5557: temp files not removed on Win32, since a file cannot be deleted while it is still open.  fix

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm?rev=576895&r1=576894&r2=576895&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm Tue Sep 18 06:13:09 2007
@@ -527,12 +527,6 @@
   # Clean ourself up
   $self->finish_metadata();
 
-  # delete temporary files
-  if ($self->{'tmpfiles'}) {
-    unlink @{$self->{'tmpfiles'}};
-    delete $self->{'tmpfiles'};
-  }
-
   # These will only be in the root Message node
   delete $self->{'mime_boundary_state'};
   delete $self->{'mbox_sep'};
@@ -546,6 +540,11 @@
 
   # Go ahead and clean up all of the Message::Node parts
   while (my $part = shift @toclean) {
+    # bug 5557: windows requires tmp file be closed before it can be rm'd
+    if (ref $part->{'raw'} eq 'GLOB') {
+      close ($part->{'raw'});
+    }
+
     delete $part->{'headers'};
     delete $part->{'raw_headers'};
     delete $part->{'header_order'};
@@ -562,6 +561,12 @@
       push(@toclean, @{$part->{'body_parts'}});
       delete $part->{'body_parts'};
     }
+  }
+
+  # delete temporary files
+  if ($self->{'tmpfiles'}) {
+    unlink @{$self->{'tmpfiles'}};
+    delete $self->{'tmpfiles'};
   }
 }