Project

General

Profile

« Previous | Next » 

Revision d96a39ba

Added by Phil Davis almost 9 years ago

Make unlink_if_exists return true/false

This allows the caller to do a single "atomic" call to unlink_if_exists.
If it returns true, then they know that the file existed and that it has
been unlinked successfully.
This should help avoid race conditions where multiple code paths try
sequences like:

if (file_exists("somefile") {
unlink("somefile");
do_other_stuff();
}

in the case where we really only want do_other_stuff() to happen for the
code path that is the first one to actually unlink the file.

  • added
  • modified
  • copied
  • renamed
  • deleted