From: ndparker <> Date: Tue, 20 Mar 2001 09:02:01 +0000 (+0000) Subject: now the reference counter file will be deleted if the counter is zero - lets save... X-Git-Url: https://git.p6c8.net/selfforum.git/commitdiff_plain/d84105ee16d0628fd000249433bcac116c80a87d?ds=inline now the reference counter file will be deleted if the counter is zero - lets save HD-Memory! ;) --- diff --git a/selfforum-cgi/shared/Lock.pm b/selfforum-cgi/shared/Lock.pm index 1d2c929..b1e42d3 100644 --- a/selfforum-cgi/shared/Lock.pm +++ b/selfforum-cgi/shared/Lock.pm @@ -476,9 +476,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 +528,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));