diff options
Diffstat (limited to 'lib/libzfs/libzfs_util.c')
-rw-r--r-- | lib/libzfs/libzfs_util.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index fa55fd3a6..65b04c59a 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1029,16 +1029,18 @@ zfs_strcmp_pathname(char *name, char *cmp, int wholedisk) int path_len, cmp_len; char path_name[MAXPATHLEN]; char cmp_name[MAXPATHLEN]; - char *dir; + char *dir, *dup; /* Strip redundant slashes if one exists due to ZPOOL_IMPORT_PATH */ memset(cmp_name, 0, MAXPATHLEN); - dir = strtok(cmp, "/"); + dup = strdup(cmp); + dir = strtok(dup, "/"); while (dir) { strcat(cmp_name, "/"); strcat(cmp_name, dir); dir = strtok(NULL, "/"); } + free(dup); if (name[0] != '/') return (zfs_strcmp_shortname(name, cmp_name, wholedisk)); |