]> git.p6c8.net - selfforum.git/blobdiff - selfforum-cgi/shared/Template/Archive.pm
print_month_as_HTML(): use locking for index-file
[selfforum.git] / selfforum-cgi / shared / Template / Archive.pm
index ec5ee22cbd83d3df14d51caa895838b169eac3e6..c71c359d6d31632750e429f150fd1c1deee95e2b 100644 (file)
@@ -73,7 +73,14 @@ sub print_month_as_HTML($$$) {
 
     my $template = new Template $tempfile;
 
-    my $threads = get_all_threads($mainfile, KILL_DELETED);
+    my ($threads, $locked);
+    unless ($locked = lock_file($mainfile) and $threads = get_all_threads($mainfile, KILL_DELETED)) {
+        print ${$template->scrap(
+            $assign->{'errorLocking'}
+        )};
+        return;
+    }
+    unlock_file($mainfile);
 
     my $tmplparam = {
             $assign->{'year'}           => $param->{'year'},

patrick-canterino.de