X-Git-Url: https://git.p6c8.net/selfforum.git/blobdiff_plain/ba659b53059e637777865e646f0f2a6fb7f2988e..aaff267fdddc495df3bfa2fc0eb0d20a76b6d220:/selfforum-cgi/shared/Lock.pm?ds=inline diff --git a/selfforum-cgi/shared/Lock.pm b/selfforum-cgi/shared/Lock.pm index 1d2c929..f7234f0 100644 --- a/selfforum-cgi/shared/Lock.pm +++ b/selfforum-cgi/shared/Lock.pm @@ -12,14 +12,13 @@ use strict; package Lock; -use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS $Timeout $violentTimeout $masterTimeout $iAmMaster); +use vars qw(@EXPORT_OK %EXPORT_TAGS $Timeout $violentTimeout $masterTimeout $iAmMaster); # ==================================================== # Funktionsexport # ==================================================== -require Exporter; -@ISA = qw(Exporter); +use base qw(Exporter); @EXPORT_OK = qw(lock_file unlock_file write_lock_file write_unlock_file violent_unlock_file set_master_lock release_file); @@ -476,9 +475,16 @@ sub w_set_ref ($$$) { # Neuen Referenzwert schreiben $old+=$z; $old=0 if ($old < 0); - open REF,">$reffile" or return 0; - print REF $old; - close REF or return 0; + if ($old == 0) + { + unlink $reffile or return 0; + } + else + { + open REF,">$reffile" or return 0; + print REF $old or return 0; + close REF or return 0; + } # wieder entsperren return 0 unless(&simple_unlock($reffile)); @@ -521,9 +527,16 @@ sub x_set_ref ($$$) { # Neuen Referenzwert schreiben $old += $z; $old = 0 if ($old < 0); - open REF,">$reffile" or return 0; - print REF $old; - close REF or return 0; + if ($old == 0) + { + unlink $reffile or return 0; + } + else + { + open REF,">$reffile" or return 0; + print REF $old or return 0; + close REF or return 0; + } # wieder entsperren return 0 unless(&simple_unlock($reffile));