< prev index next >

src/java.base/macosx/native/libjli/java_md_macosx.m

Print this page
rev 52684 : imported patch open.patch


 491       p = strrchr(jvm_cfg, '/'); *p = '\0';
 492     }
 493     else *p = '\0';
 494     strncpy(path, jvm_cfg, pathsize);
 495     strncat(jvm_cfg, "/lib/jvm.cfg", MAXPATHLEN);
 496     if (access(jvm_cfg, F_OK) == 0) {
 497       return JNI_TRUE;
 498     }
 499 #endif
 500 
 501     char *realPathToSelf = realpath(selfInfo.dli_fname, path);
 502     if (realPathToSelf != path) {
 503         return JNI_FALSE;
 504     }
 505 
 506     size_t pathLen = strlen(realPathToSelf);
 507     if (pathLen == 0) {
 508         return JNI_FALSE;
 509     }
 510 
 511     const char lastPathComponent[] = "/lib/jli/libjli.dylib";
 512     size_t sizeOfLastPathComponent = sizeof(lastPathComponent) - 1;
 513     if (pathLen < sizeOfLastPathComponent) {
 514         return JNI_FALSE;
 515     }
 516 
 517     size_t indexOfLastPathComponent = pathLen - sizeOfLastPathComponent;
 518     if (0 == strncmp(realPathToSelf + indexOfLastPathComponent, lastPathComponent, sizeOfLastPathComponent - 1)) {
 519         realPathToSelf[indexOfLastPathComponent + 1] = '\0';
 520         return JNI_TRUE;
 521     }
 522 
 523     if (!speculative)
 524       JLI_ReportErrorMessage(JRE_ERROR8 JAVA_DLL);
 525     return JNI_FALSE;
 526 }
 527 
 528 jboolean
 529 LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
 530 {
 531     Dl_info dlinfo;




 491       p = strrchr(jvm_cfg, '/'); *p = '\0';
 492     }
 493     else *p = '\0';
 494     strncpy(path, jvm_cfg, pathsize);
 495     strncat(jvm_cfg, "/lib/jvm.cfg", MAXPATHLEN);
 496     if (access(jvm_cfg, F_OK) == 0) {
 497       return JNI_TRUE;
 498     }
 499 #endif
 500 
 501     char *realPathToSelf = realpath(selfInfo.dli_fname, path);
 502     if (realPathToSelf != path) {
 503         return JNI_FALSE;
 504     }
 505 
 506     size_t pathLen = strlen(realPathToSelf);
 507     if (pathLen == 0) {
 508         return JNI_FALSE;
 509     }
 510 
 511     const char lastPathComponent[] = "/lib/libjli.dylib";
 512     size_t sizeOfLastPathComponent = sizeof(lastPathComponent) - 1;
 513     if (pathLen < sizeOfLastPathComponent) {
 514         return JNI_FALSE;
 515     }
 516 
 517     size_t indexOfLastPathComponent = pathLen - sizeOfLastPathComponent;
 518     if (0 == strncmp(realPathToSelf + indexOfLastPathComponent, lastPathComponent, sizeOfLastPathComponent - 1)) {
 519         realPathToSelf[indexOfLastPathComponent + 1] = '\0';
 520         return JNI_TRUE;
 521     }
 522 
 523     if (!speculative)
 524       JLI_ReportErrorMessage(JRE_ERROR8 JAVA_DLL);
 525     return JNI_FALSE;
 526 }
 527 
 528 jboolean
 529 LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
 530 {
 531     Dl_info dlinfo;


< prev index next >