changeset 58968:82db5000a845

8234339: replace JLI_StrTok in java_md_solinux.c Reviewed-by: clanger, rriggs
author mbaesken
date Mon, 18 Nov 2019 16:49:39 +0100
parents 47c879f478d2
children a1155217a563
files src/java.base/share/native/libjli/jli_util.h src/java.base/unix/native/libjli/java_md_solinux.c
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/native/libjli/jli_util.h	Fri Nov 22 09:25:09 2019 +0100
+++ b/src/java.base/share/native/libjli/jli_util.h	Mon Nov 18 16:49:39 2019 +0100
@@ -80,7 +80,6 @@
 #define JLI_StrSpn(p1, p2)      strspn((p1), (p2))
 #define JLI_StrCSpn(p1, p2)     strcspn((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. */
 #ifdef _WIN32
--- a/src/java.base/unix/native/libjli/java_md_solinux.c	Fri Nov 22 09:25:09 2019 +0100
+++ b/src/java.base/unix/native/libjli/java_md_solinux.c	Mon Nov 18 16:49:39 2019 +0100
@@ -188,6 +188,7 @@
     char serverPattern[] = "lib/server";
     char *envpath;
     char *path;
+    char* save_ptr = NULL;
     jboolean clientPatternFound;
     jboolean serverPatternFound;
 
@@ -207,7 +208,7 @@
      * we have a suspicious path component, check if it contains a libjvm.so
      */
     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 (JvmExists(path)) {
                 JLI_MemFree(envpath);