From 1ce6d70c52d6a7b6d8d6ec985333a3ccadc5efc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= Date: Thu, 20 May 2021 23:07:23 +0200 Subject: [PATCH] zpool: print_zpool_script_list: remove strtok MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Brian Behlendorf Reviewed-by: John Kennedy Signed-off-by: Ahelenia ZiemiaƄska Closes #12094 --- cmd/zpool/zpool_main.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index 887229d9a8..50ef9e643a 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -5369,7 +5369,7 @@ print_zpool_dir_scripts(char *dirpath) static void print_zpool_script_list(char *subcommand) { - char *dir, *sp; + char *dir, *sp, *tmp; printf(gettext("Available 'zpool %s -c' commands:\n"), subcommand); @@ -5377,11 +5377,10 @@ print_zpool_script_list(char *subcommand) if (sp == NULL) return; - dir = strtok(sp, ":"); - while (dir != NULL) { + for (dir = strtok_r(sp, ":", &tmp); + dir != NULL; + dir = strtok_r(NULL, ":", &tmp)) print_zpool_dir_scripts(dir); - dir = strtok(NULL, ":"); - } free(sp); }