From fb7125ee5dfb5b1f491974cbb276ff9592a955ec Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 18 Oct 2006 20:19:31 +0200 Subject: unlock files if write failed darcs-hash:20061018181931-7ad00-2778b83d25e8dcfad4b00710077e44bcef9af699.gz --- inc/io.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'inc') 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); -- cgit v1.2.3