aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzutil
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-05-20 22:49:59 +0200
committerBrian Behlendorf <[email protected]>2021-05-26 14:50:46 -0700
commit2a8c6060823f98360763038fbb79d2d5922bb6bb (patch)
tree44d8d2ba6f2bfa98e3cec73e54396dca81b4df6f /lib/libzutil
parent91d67806719c80fbdcf1b4fd47862ae4ac2b7f74 (diff)
libzutil: zfs_resolve_shortname: 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/libzutil')
-rw-r--r--lib/libzutil/zutil_device_path.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libzutil/zutil_device_path.c b/lib/libzutil/zutil_device_path.c
index 518f94161..bcdc72baa 100644
--- a/lib/libzutil/zutil_device_path.c
+++ b/lib/libzutil/zutil_device_path.c
@@ -41,18 +41,18 @@ int
zfs_resolve_shortname(const char *name, char *path, size_t len)
{
int i, error = -1;
- char *dir, *env, *envdup;
+ char *dir, *env, *envdup, *tmp = NULL;
env = getenv("ZPOOL_IMPORT_PATH");
errno = ENOENT;
if (env) {
envdup = strdup(env);
- dir = strtok(envdup, ":");
- while (dir && error) {
+ for (dir = strtok_r(envdup, ":", &tmp);
+ dir != NULL && error != 0;
+ dir = strtok_r(NULL, ":", &tmp)) {
(void) snprintf(path, len, "%s/%s", dir, name);
error = access(path, F_OK);
- dir = strtok(NULL, ":");
}
free(envdup);
} else {