Jelajahi Sumber

Fixing environment variable parsing in PAL

The `compare` function used in MiscGetenv checks if the first argument
is a prefix of the second argument, but MiscGetenv was passing the longer
argument (e.g. "HOME=/users/foo") first, meaning that it would never
find any environment variable.
Jimmy Thomson 8 tahun lalu
induk
melakukan
8590a26f07
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      pal/src/cruntime/misc.cpp

+ 1 - 1
pal/src/cruntime/misc.cpp

@@ -360,7 +360,7 @@ char *MiscGetenv(const char *name)
     {
         for(i = 0; palEnvironment[i] != NULL; i++)
         {
-            if (compare(palEnvironment[i], name, &length) == 0)
+            if (compare(name, palEnvironment[i], &length) == 0)
             {
                 equals = palEnvironment[i] + length;
                 if (*equals == '\0')