Skip to content

Commit

Permalink
Merge pull request #7835 from Sesquipedalian/safe_file_write_no_backu…
Browse files Browse the repository at this point in the history
…p_file
  • Loading branch information
Sesquipedalian authored Sep 1, 2023
2 parents 194eae6 + b3fbd32 commit a8a4318
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/Subs-Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ function safe_file_write($file, $data, $backup_file = null, $mtime = null, $appe
if (!$failed)
{
// Back up the backup, just in case.
if (file_exists($backup_file))
if (!empty($backup_file) && file_exists($backup_file))
$temp_bfile_saved = @copy($backup_file, $temp_bfile);

// Make sure no one changed the file while we weren't looking.
Expand Down Expand Up @@ -1926,7 +1926,9 @@ function safe_file_write($file, $data, $backup_file = null, $mtime = null, $appe

// We're done with these.
@unlink($temp_sfile);
@unlink($temp_bfile);

if (!empty($temp_bfile))
@unlink($temp_bfile);

if ($failed)
return false;
Expand Down

0 comments on commit a8a4318

Please sign in to comment.