[libcxx-commits] [PATCH] D130214: [libc++][test] Fix infinite loop when mkstemp fails

Ryan Prichard via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 22 16:21:16 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGb4722cc4c96e: [libc++][test] Fix infinite loop when mkstemp fails (authored by rprichard).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130214/new/

https://reviews.llvm.org/D130214

Files:
  libcxx/test/support/platform_support.h


Index: libcxx/test/support/platform_support.h
===================================================================
--- libcxx/test/support/platform_support.h
+++ libcxx/test/support/platform_support.h
@@ -75,16 +75,12 @@
         abort();
     }
 #else
-    std::string Name;
-    int FD = -1;
-    do {
-        Name = "libcxx.XXXXXX";
-        FD = mkstemp(&Name[0]);
-        if (FD == -1 && errno == EINVAL) {
-            perror("mkstemp");
-            abort();
-        }
-    } while (FD == -1);
+    std::string Name = "libcxx.XXXXXX";
+    int FD = mkstemp(&Name[0]);
+    if (FD == -1) {
+        perror("mkstemp");
+        abort();
+    }
     close(FD);
     return Name;
 #endif


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130214.447001.patch
Type: text/x-patch
Size: 693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220722/f438d862/attachment-0001.bin>


More information about the libcxx-commits mailing list