[Lldb-commits] [lldb] r283237 - Fix FixupEnvironment on Android after the Args refactor

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 4 11:35:39 PDT 2016


Author: tberghammer
Date: Tue Oct  4 13:35:39 2016
New Revision: 283237

URL: http://llvm.org/viewvc/llvm-project?rev=283237&view=rev
Log:
Fix FixupEnvironment on Android after the Args refactor

Modified:
    lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp

Modified: lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp?rev=283237&r1=283236&r2=283237&view=diff
==============================================================================
--- lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp (original)
+++ lldb/trunk/source/Host/linux/ProcessLauncherLinux.cpp Tue Oct  4 13:35:39 2016
@@ -28,14 +28,15 @@ using namespace lldb_private;
 static void FixupEnvironment(Args &env) {
 #ifdef __ANDROID_NDK__
   // If there is no PATH variable specified inside the environment then set the
-  // path to /system/bin.
-  // It is required because the default path used by execve() is wrong on
-  // android.
+  // path to /system/bin. It is required because the default path used by
+  // execve() is wrong on android.
   static const char *path = "PATH=";
   static const int path_len = ::strlen(path);
-  for (const char **args = env.GetConstArgumentVector(); *args; ++args)
-    if (::strncmp(path, *args, path_len) == 0)
+  for (size_t i = 0; i < env.GetArgumentCount(); ++i) {
+    const char *arg = env.GetArgumentAtIndex(i);
+    if (::strncmp(path, arg, path_len) == 0)
       return;
+  }
   env.AppendArgument(llvm::StringRef("PATH=/system/bin"));
 #endif
 }




More information about the lldb-commits mailing list