--- old/src/solaris/demo/jvmti/hprof/hprof_md.c 2013-03-04 19:20:10.433722209 +0100 +++ new/src/solaris/demo/jvmti/hprof/hprof_md.c 2013-03-04 19:20:10.261722202 +0100 @@ -385,6 +385,7 @@ // Loosely based on os_solaris.cpp char *pathname = (char *)pname; + *buffer = '\0'; while (strlen(pathname) > 0) { char *p = strchr(pathname, ':'); if (p == NULL) { @@ -395,12 +396,16 @@ continue; } (void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX, - (p - pathname), pathname, fname); + (int)(p - pathname), pathname, fname); if (access(buffer, F_OK) == 0) { - break; + break; } - pathname = p + 1; + if (*p == '\0') { + pathname = p; + } else { + pathname = p + 1; + } *buffer = '\0'; } }