diff options
author | pjd <pjd@FreeBSD.org> | 2009-08-17 09:34:00 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2009-08-17 09:34:00 +0000 |
commit | 2a9e26ee0b5f26db25a9616883cd50fbf3d04d18 (patch) | |
tree | e411017e4c4c97b6be53c48d1e271c82044082bc | |
parent | 0a73e21177130a9d34b2ea06f32faf57ae8eb18f (diff) | |
download | FreeBSD-src-2a9e26ee0b5f26db25a9616883cd50fbf3d04d18.zip FreeBSD-src-2a9e26ee0b5f26db25a9616883cd50fbf3d04d18.tar.gz |
Fix receive when dataset has no / in its name.
Submitted by: James R. Van Artsdalen <james-freebsd-current@jrv.org>
Approved by: re (kib)
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c index 110fa88..5ee17fb 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c @@ -1126,7 +1126,7 @@ again: uint64_t originguid = 0; uint64_t stream_originguid = 0; uint64_t parent_fromsnap_guid, stream_parent_fromsnap_guid; - char *fsname, *stream_fsname; + char *fsname, *stream_fsname, *p1, *p2; nextfselem = nvlist_next_nvpair(local_nv, fselem); @@ -1295,10 +1295,11 @@ again: "parentfromsnap", &stream_parent_fromsnap_guid)); /* check for rename */ + p1 = strrchr(fsname, '/'); + p2 = strrchr(stream_fsname, '/'); if ((stream_parent_fromsnap_guid != 0 && stream_parent_fromsnap_guid != parent_fromsnap_guid) || - strcmp(strrchr(fsname, '/'), - strrchr(stream_fsname, '/')) != 0) { + (p1 != NULL && p2 != NULL && strcmp (p1, p2) != 0)) { nvlist_t *parent; char tryname[ZFS_MAXNAMELEN]; @@ -1317,7 +1318,7 @@ again: VERIFY(0 == nvlist_lookup_string(parent, "name", &pname)); (void) snprintf(tryname, sizeof (tryname), - "%s%s", pname, strrchr(stream_fsname, '/')); + "%s%s", pname, p2 != NULL ? p2 : ""); } else { tryname[0] = '\0'; if (flags.verbose) { |