src/solaris/demo/jvmti/hprof/hprof_md.c

Print this page
rev 6641 : [mq]: PrivateTransportTest

*** 383,408 **** static void dll_build_name(char* buffer, size_t buflen, const char* pname, const char* fname) { // Loosely based on os_solaris.cpp char *pathname = (char *)pname; while (strlen(pathname) > 0) { char *p = strchr(pathname, ':'); if (p == NULL) { p = pathname + strlen(pathname); } /* check for NULL path */ if (p == pathname) { continue; } (void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX, ! (p - pathname), pathname, fname); if (access(buffer, F_OK) == 0) { break; } pathname = p + 1; *buffer = '\0'; } } /* Create the actual fill filename for a dynamic library. */ --- 383,413 ---- static void dll_build_name(char* buffer, size_t buflen, const char* pname, const char* fname) { // Loosely based on os_solaris.cpp char *pathname = (char *)pname; + *buffer = '\0'; while (strlen(pathname) > 0) { char *p = strchr(pathname, ':'); if (p == NULL) { p = pathname + strlen(pathname); } /* check for NULL path */ if (p == pathname) { continue; } (void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX, ! (int)(p - pathname), pathname, fname); if (access(buffer, F_OK) == 0) { break; } + if (*p == '\0') { + pathname = p; + } else { pathname = p + 1; + } *buffer = '\0'; } } /* Create the actual fill filename for a dynamic library. */