Fix FixupEnvironment on Android after the Args refactor
authorTamas Berghammer <tberghammer@google.com>
Tue, 4 Oct 2016 18:35:39 +0000 (18:35 +0000)
committerTamas Berghammer <tberghammer@google.com>
Tue, 4 Oct 2016 18:35:39 +0000 (18:35 +0000)
llvm-svn: 283237

lldb/source/Host/linux/ProcessLauncherLinux.cpp

index a769f1a..cc18fed 100644 (file)
@@ -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
 }