summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-05-20 23:07:23 +0200
committerBrian Behlendorf <[email protected]>2021-05-26 14:51:03 -0700
commit1ce6d70c52d6a7b6d8d6ec985333a3ccadc5efc1 (patch)
tree7a74a458dc0b0833865a0cf8b274f847b5f8ce4a /cmd
parenta281f7690da598964168f4100571cc39b93a8cab (diff)
zpool: print_zpool_script_list: remove strtok
Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #12094
Diffstat (limited to 'cmd')
-rw-r--r--cmd/zpool/zpool_main.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index 887229d9a..50ef9e643 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);
}