aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-05-20 22:51:06 +0200
committerBrian Behlendorf <[email protected]>2021-05-26 14:50:52 -0700
commit31f4c8cb19bf3f7a1629e259af77d8a63f3816fd (patch)
tree4c2e42a8110d453d9bcad0547e3da8611555fabc /lib
parent2a8c6060823f98360763038fbb79d2d5922bb6bb (diff)
linux/libzutil: zfs_path_order: 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 'lib')
-rw-r--r--lib/libzutil/os/linux/zutil_import_os.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/libzutil/os/linux/zutil_import_os.c b/lib/libzutil/os/linux/zutil_import_os.c
index 61c42cf2e..84c3cb44f 100644
--- a/lib/libzutil/os/linux/zutil_import_os.c
+++ b/lib/libzutil/os/linux/zutil_import_os.c
@@ -283,21 +283,20 @@ zpool_default_search_paths(size_t *count)
static int
zfs_path_order(char *name, int *order)
{
- int i = 0, error = ENOENT;
- char *dir, *env, *envdup;
+ int i, error = ENOENT;
+ char *dir, *env, *envdup, *tmp = NULL;
env = getenv("ZPOOL_IMPORT_PATH");
if (env) {
envdup = strdup(env);
- dir = strtok(envdup, ":");
- while (dir) {
+ for (dir = strtok_r(envdup, ":", &tmp), i = 0;
+ dir != NULL;
+ dir = strtok_r(NULL, ":", &tmp), i++) {
if (strncmp(name, dir, strlen(dir)) == 0) {
*order = i;
error = 0;
break;
}
- dir = strtok(NULL, ":");
- i++;
}
free(envdup);
} else {