SVN: toys/rsget.pl/RSGet/FileList.pm

sparky sparky at pld-linux.org
Mon Aug 2 22:46:31 CEST 2010


Author: sparky
Date: Mon Aug  2 22:46:31 2010
New Revision: 11754

Modified:
   toys/rsget.pl/RSGet/FileList.pm
Log:
- force file list rewrite on termination, even if list lock is
  active, solves RSGETPL-27


Modified: toys/rsget.pl/RSGet/FileList.pm
==============================================================================
--- toys/rsget.pl/RSGet/FileList.pm	(original)
+++ toys/rsget.pl/RSGet/FileList.pm	Mon Aug  2 22:46:31 2010
@@ -71,7 +71,11 @@
 }
 
 END {
-	list_close $list_fh if $list_fh;
+	if ( $list_fh ) {
+		$update = 2;
+		readlist();
+		list_close $list_fh;
+	}
 }
 
 sub set_file
@@ -412,8 +416,11 @@
 		}
 	}
 	
-	# we are forced to regenerate the list if there was something added
-	unlink $file_swp if @added or $update == 2;
+	if ( ( @added or $update == 2 ) and -e $file_swp ) {
+		# we are forced to regenerate the list if there was something added
+		warn "Forced $file rewrite, your file lock will be broken\n";
+		unlink $file_swp;
+	}
 
 	unless ( -e $file_swp ) {
 		my $fh = list_open $file . ".tmp";


More information about the pld-cvs-commit mailing list