diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/mount_zfs/mount_zfs.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cmd/mount_zfs/mount_zfs.c b/cmd/mount_zfs/mount_zfs.c index 32f092199..fbb954acd 100644 --- a/cmd/mount_zfs/mount_zfs.c +++ b/cmd/mount_zfs/mount_zfs.c @@ -218,10 +218,14 @@ static char * parse_dataset(char *dataset) { char cwd[PATH_MAX]; + int len; (void) getcwd(cwd, PATH_MAX); - if (!strncmp(cwd, dataset, strlen(cwd))) - return (dataset + strlen(cwd) + 1); + len = strlen(cwd); + + /* Do not add one when cwd already ends in a trailing '/' */ + if (!strncmp(cwd, dataset, len)) + return (dataset + len + (cwd[len-1] != '/')); return (dataset); } |