aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
}