362 char* java_home = getenv("JAVA_HOME"); |
362 char* java_home = getenv("JAVA_HOME"); |
363 if (java_home != NULL) { |
363 if (java_home != NULL) { |
364 strcpy(filepath, java_home); |
364 strcpy(filepath, java_home); |
365 } else { |
365 } else { |
366 char* dyldpath = getenv("DYLD_LIBRARY_PATH"); |
366 char* dyldpath = getenv("DYLD_LIBRARY_PATH"); |
367 char* dypath = strtok(dyldpath, ":"); |
367 char* save_ptr; |
|
368 char* dypath = strtok_r(dyldpath, ":", &save_ptr); |
368 while (dypath != NULL) { |
369 while (dypath != NULL) { |
369 strcpy(filepath, dypath); |
370 strcpy(filepath, dypath); |
370 strcat(filepath, filename); |
371 strcat(filepath, filename); |
371 if (exists(filepath)) { |
372 if (exists(filepath)) { |
372 strcpy(rpath, filepath); |
373 strcpy(rpath, filepath); |
373 return true; |
374 return true; |
374 } |
375 } |
375 dypath = strtok(dyldpath, ":"); |
376 dypath = strtok_r(NULL, ":", &save_ptr); |
376 } |
377 } |
377 // not found |
378 // not found |
378 return false; |
379 return false; |
379 } |
380 } |
380 } |
381 } |