[llvm] r178908 - <rdar://problem/13551789> Fix yet another race in unique_file.

Douglas Gregor dgregor at apple.com
Fri Apr 5 13:48:37 PDT 2013


Author: dgregor
Date: Fri Apr  5 15:48:36 2013
New Revision: 178908

URL: http://llvm.org/viewvc/llvm-project?rev=178908&view=rev
Log:
<rdar://problem/13551789> Fix yet another race in unique_file.

If the directory that will contain the unique file doesn't exist when
we tried to create the file, but another process creates it before we
get a chance to try creating it, we would bail out rather than try to
create the unique file.


Modified:
    llvm/trunk/lib/Support/Unix/PathV2.inc

Modified: llvm/trunk/lib/Support/Unix/PathV2.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/PathV2.inc?rev=178908&r1=178907&r2=178908&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/PathV2.inc (original)
+++ llvm/trunk/lib/Support/Unix/PathV2.inc Fri Apr  5 15:48:36 2013
@@ -430,9 +430,7 @@ rety_open_create:
     if (SavedErrno == errc::file_exists)
       goto retry_random_path;
     // If path prefix doesn't exist, try to create it.
-    if (SavedErrno == errc::no_such_file_or_directory &&
-        !exists(path::parent_path(RandomPath)) &&
-        !TriedToCreateParent) {
+    if (SavedErrno == errc::no_such_file_or_directory && !TriedToCreateParent) {
       TriedToCreateParent = true;
       StringRef p(RandomPath);
       SmallString<64> dir_to_create;





More information about the llvm-commits mailing list