src/windows/demo/jvmti/hprof/hprof_md.c
Print this page
rev 6641 : [mq]: PrivateTransportTest
*** 370,399 ****
static void dll_build_name(char* buffer, size_t buflen,
const char* pname, const char* fname) {
// Loosley based on os_windows.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;
}
if (*(p-1) == ':' || *(p-1) == '\\') {
! (void)_snprintf(buffer, buflen, "%.*s%s.dll", (p - pathname),
pathname, fname);
} else {
! (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (p - pathname),
pathname, fname);
}
if (_access(buffer, 0) == 0) {
break;
}
pathname = p + 1;
*buffer = '\0';
}
}
/* Build a machine dependent library name out of a path and file name. */
--- 370,404 ----
static void dll_build_name(char* buffer, size_t buflen,
const char* pname, const char* fname) {
// Loosley based on os_windows.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;
}
if (*(p-1) == ':' || *(p-1) == '\\') {
! (void)_snprintf(buffer, buflen, "%.*s%s.dll", (int)(p - pathname),
pathname, fname);
} else {
! (void)_snprintf(buffer, buflen, "%.*s\\%s.dll", (int)(p - pathname),
pathname, fname);
}
if (_access(buffer, 0) == 0) {
break;
}
+ if (*p == '\0') {
+ pathname = p;
+ } else {
pathname = p + 1;
+ }
*buffer = '\0';
}
}
/* Build a machine dependent library name out of a path and file name. */