[PATCH] D79239: getMainExecutable: Fix hand-rolled AT_EXECPATH search for older branches

Ed Maste via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 7 14:10:24 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG21e5e1724b75: getMainExecutable: Fix hand-rolled AT_EXECPATH for older FreeBSD (authored by emaste).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79239

Files:
  llvm/lib/Support/Unix/Path.inc


Index: llvm/lib/Support/Unix/Path.inc
===================================================================
--- llvm/lib/Support/Unix/Path.inc
+++ llvm/lib/Support/Unix/Path.inc
@@ -207,14 +207,9 @@
   while (*p++ != 0)
     ;
   // Iterate through auxiliary vectors for AT_EXECPATH.
-  for (;;) {
-    switch (*(uintptr_t *)p++) {
-    case AT_EXECPATH:
+  for (; *(uintptr_t *)p != AT_NULL; p++) {
+    if (*(uintptr_t *)p++ == AT_EXECPATH)
       return *p;
-    case AT_NULL:
-      break;
-    }
-    p++;
   }
 #endif
   // Fall back to argv[0] if auxiliary vectors are not available.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79239.262762.patch
Type: text/x-patch
Size: 589 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200507/6c88163c/attachment.bin>


More information about the llvm-commits mailing list