harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r487573 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c
Date Fri, 15 Dec 2006 14:40:44 GMT
Author: apetrenko
Date: Fri Dec 15 06:40:43 2006
New Revision: 487573

URL: http://svn.apache.org/viewvc?view=rev&rev=487573
Log:
Patch for HARMONY-1557 "[classlib][launcher] wrong checks for required path elements in path"

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c?view=diff&rev=487573&r1=487572&r2=487573
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/native/launcher/shared/main.c Fri
Dec 15 06:40:43 2006
@@ -977,6 +977,22 @@
   return 0;
 }
 
+static BOOLEAN findDirInPath(char *path, char *dir, char *separator)
+{
+  char *pos;
+  int dirlen = strlen(dir);
+
+  while ((pos = strchr(path, *separator)) != NULL) {
+    int pathlen = pos - path;
+    if (dirlen == pathlen && !strncmp(path, dir, dirlen)) {
+      return TRUE;
+    }
+    path += pathlen + 1;
+  }
+
+  return !strcmp(dir, path);
+}
+
 /**
 * Update path to point to directory containing VM's DLLs 
 * 
@@ -1021,7 +1037,8 @@
    */
     
   for (i=0; i < count; i++) { 
-    if (newPathToAdd[i] != NULL && strstr(oldPath, newPathToAdd[i]) != 0) {
+    if (newPathToAdd[i] != NULL
+        && findDirInPath(oldPath, newPathToAdd[i], separator) != 0) {
         found++;
     }
   }
@@ -1042,7 +1059,8 @@
   strLen = strlen(variableName) + strlen("=") + strlen(oldPath);
   
   for (i=0; i < count; i++) {
-    if (newPathToAdd[i] != NULL && strstr(oldPath, newPathToAdd[i]) == 0) {
+    if (newPathToAdd[i] != NULL
+        && findDirInPath(oldPath, newPathToAdd[i],separator) == 0) {
         strLen += strlen(newPathToAdd[i]);
         strLen++; // for each separator
     }
@@ -1054,7 +1072,8 @@
   strcat (newPath, "=");
   
   for (i=0; i < count; i++) { 
-    if (newPathToAdd[i] != NULL && strstr(oldPath, newPathToAdd[i]) == 0) {
+    if (newPathToAdd[i] != NULL
+        && findDirInPath(oldPath, newPathToAdd[i], separator) == 0) {
         if (i != 0) {
             strcat(newPath, separator);
         }



Mime
View raw message