Fix receive when dataset has no / in its name.
Submitted by: James R. Van Artsdalen <james-freebsd-current@jrv.org> Approved by: re (kib)
This commit is contained in:
parent
0a73e21177
commit
2a9e26ee0b
@ -1126,7 +1126,7 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
|
||||
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 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
|
||||
"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 @@ recv_incremental_replication(libzfs_handle_t *hdl, const char *tofs,
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user