383 static void dll_build_name(char* buffer, size_t buflen, |
383 static void dll_build_name(char* buffer, size_t buflen, |
384 const char* pname, const char* fname) { |
384 const char* pname, const char* fname) { |
385 // Loosely based on os_solaris.cpp |
385 // Loosely based on os_solaris.cpp |
386 |
386 |
387 char *pathname = (char *)pname; |
387 char *pathname = (char *)pname; |
|
388 *buffer = '\0'; |
388 while (strlen(pathname) > 0) { |
389 while (strlen(pathname) > 0) { |
389 char *p = strchr(pathname, ':'); |
390 char *p = strchr(pathname, ':'); |
390 if (p == NULL) { |
391 if (p == NULL) { |
391 p = pathname + strlen(pathname); |
392 p = pathname + strlen(pathname); |
392 } |
393 } |
393 /* check for NULL path */ |
394 /* check for NULL path */ |
394 if (p == pathname) { |
395 if (p == pathname) { |
395 continue; |
396 continue; |
396 } |
397 } |
397 (void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX, |
398 (void)snprintf(buffer, buflen, "%.*s/lib%s" JNI_LIB_SUFFIX, |
398 (p - pathname), pathname, fname); |
399 (int)(p - pathname), pathname, fname); |
399 |
400 |
400 if (access(buffer, F_OK) == 0) { |
401 if (access(buffer, F_OK) == 0) { |
401 break; |
402 break; |
402 } |
403 } |
403 pathname = p + 1; |
404 if (*p == '\0') { |
|
405 pathname = p; |
|
406 } else { |
|
407 pathname = p + 1; |
|
408 } |
404 *buffer = '\0'; |
409 *buffer = '\0'; |
405 } |
410 } |
406 } |
411 } |
407 |
412 |
408 /* Create the actual fill filename for a dynamic library. */ |
413 /* Create the actual fill filename for a dynamic library. */ |