8234339: replace JLI_StrTok in java_md_solinux.c

Reviewed-by: clanger, rriggs
This commit is contained in:
Matthias Baesken 2019-11-18 16:49:39 +01:00
parent b240008ba2
commit 70c5d41f28
2 changed files with 2 additions and 2 deletions

View File

@ -80,7 +80,6 @@ JLI_GetAppArgIndex();
#define JLI_StrSpn(p1, p2) strspn((p1), (p2)) #define JLI_StrSpn(p1, p2) strspn((p1), (p2))
#define JLI_StrCSpn(p1, p2) strcspn((p1), (p2)) #define JLI_StrCSpn(p1, p2) strcspn((p1), (p2))
#define JLI_StrPBrk(p1, p2) strpbrk((p1), (p2)) #define JLI_StrPBrk(p1, p2) strpbrk((p1), (p2))
#define JLI_StrTok(p1, p2) strtok((p1), (p2))
/* On Windows lseek() is in io.h rather than the location dictated by POSIX. */ /* On Windows lseek() is in io.h rather than the location dictated by POSIX. */
#ifdef _WIN32 #ifdef _WIN32

View File

@ -188,6 +188,7 @@ ContainsLibJVM(const char *env) {
char serverPattern[] = "lib/server"; char serverPattern[] = "lib/server";
char *envpath; char *envpath;
char *path; char *path;
char* save_ptr = NULL;
jboolean clientPatternFound; jboolean clientPatternFound;
jboolean serverPatternFound; jboolean serverPatternFound;
@ -207,7 +208,7 @@ ContainsLibJVM(const char *env) {
* we have a suspicious path component, check if it contains a libjvm.so * we have a suspicious path component, check if it contains a libjvm.so
*/ */
envpath = JLI_StringDup(env); envpath = JLI_StringDup(env);
for (path = JLI_StrTok(envpath, ":"); path != NULL; path = JLI_StrTok(NULL, ":")) { for (path = strtok_r(envpath, ":", &save_ptr); path != NULL; path = strtok_r(NULL, ":", &save_ptr)) {
if (clientPatternFound && JLI_StrStr(path, clientPattern) != NULL) { if (clientPatternFound && JLI_StrStr(path, clientPattern) != NULL) {
if (JvmExists(path)) { if (JvmExists(path)) {
JLI_MemFree(envpath); JLI_MemFree(envpath);