summaryrefslogtreecommitdiff
path: root/inc/io.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-10-18 20:19:31 +0200
committerAndreas Gohr <andi@splitbrain.org>2006-10-18 20:19:31 +0200
commitfb7125ee5dfb5b1f491974cbb276ff9592a955ec (patch)
tree33edee89e60a7eb527df0265bbfc09e202e5944f /inc/io.php
parent2356b509c72593217e14e024eae3bfa2ff8f0b20 (diff)
downloadrpg-fb7125ee5dfb5b1f491974cbb276ff9592a955ec.tar.gz
rpg-fb7125ee5dfb5b1f491974cbb276ff9592a955ec.tar.bz2
unlock files if write failed
darcs-hash:20061018181931-7ad00-2778b83d25e8dcfad4b00710077e44bcef9af699.gz
Diffstat (limited to 'inc/io.php')
-rw-r--r--inc/io.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/inc/io.php b/inc/io.php
index 3bcde79ce..d941ef05f 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -177,6 +177,7 @@ function io_saveFile($file,$content,$append=false){
$fh = @gzopen($file,$mode.'9');
if(!$fh){
msg("Writing $file failed",-1);
+ io_unlock($file);
return false;
}
gzwrite($fh, $content);
@@ -185,6 +186,7 @@ function io_saveFile($file,$content,$append=false){
$fh = @bzopen($file,$mode);
if(!$fh){
msg("Writing $file failed", -1);
+ io_unlock($file);
return false;
}
bzwrite($fh, $content);
@@ -193,6 +195,7 @@ function io_saveFile($file,$content,$append=false){
$fh = @fopen($file,$mode);
if(!$fh){
msg("Writing $file failed",-1);
+ io_unlock($file);
return false;
}
fwrite($fh, $content);
@@ -245,6 +248,7 @@ function io_deleteFromFile($file,$badline,$regex=false){
$fh = @gzopen($file,'wb9');
if(!$fh){
msg("Removing content from $file failed",-1);
+ io_unlock($file);
return false;
}
gzwrite($fh, $content);
@@ -253,6 +257,7 @@ function io_deleteFromFile($file,$badline,$regex=false){
$fh = @fopen($file,'wb');
if(!$fh){
msg("Removing content from $file failed",-1);
+ io_unlock($file);
return false;
}
fwrite($fh, $content);