This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch hotfix/ubuntu-cmake
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 6cbbc237e137ec4d4f4a1d04160be452f48bf8da
Author: PengZheng <[email protected]>
AuthorDate: Wed Apr 2 20:33:21 2025 +0800

    Replace strtok by reentrant version.
---
 bundles/shell/shell/src/dm_shell_list_command.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/bundles/shell/shell/src/dm_shell_list_command.c 
b/bundles/shell/shell/src/dm_shell_list_command.c
index 7148c27aa..6ba604ae9 100644
--- a/bundles/shell/shell/src/dm_shell_list_command.c
+++ b/bundles/shell/shell/src/dm_shell_list_command.c
@@ -31,8 +31,9 @@ static void parseCommandLine(const char*line, 
celix_array_list_t **requestedBund
     *wtf = false;
     char *str = strdup(line);
     // skip first argument since this is the command
-    strtok(str," ");
-    char* tok = strtok(NULL," ");
+    char* save = NULL;
+    strtok_r(str," ", &save);
+    char* tok = strtok_r(NULL," ", &save);
     *requestedBundleIds = celix_arrayList_create();
     while (tok) {
         if (strncmp("wtf", tok, strlen("wtf")) == 0) {
@@ -45,7 +46,7 @@ static void parseCommandLine(const char*line, 
celix_array_list_t **requestedBund
         } else {
             fprintf (err, "DM: Skipping unknown argument: %s", tok );
         }
-        tok = strtok(NULL," ");
+        tok = strtok_r(NULL," ", &save);
     }
     free (str);
 }

Reply via email to