setarch: fix generation of new PATH environment variable.

* The insertion index didn't take into account the fact
  that some paths don't get added before the index is
  calculated. This resulted in the requested arch paths
  ending up in reverse if we were already in the
  requested arch environment.

Fixes #12125.
This commit is contained in:
Jessica Hamilton 2015-06-10 14:12:30 +12:00
parent ae59605d24
commit a5bc477663

View File

@ -109,7 +109,7 @@ compute_new_paths(const char* architecture, BStringList& _paths)
int32 index = primaryBinDirectories.IndexOf(path);
if (index >= 0) {
if (insertionIndex < 0)
insertionIndex = i;
insertionIndex = _paths.CountStrings();
} else if (!is_primary_architecture(
guess_architecture_for_path(path))) {
// a non-primary architecture path -- skip