diff options
author | Andriy Gapon <avg@FreeBSD.org> | 2019-09-04 07:33:22 +0000 |
---|---|---|
committer | Andriy Gapon <avg@FreeBSD.org> | 2019-09-04 07:33:22 +0000 |
commit | b539c9bfbd6b551c3899e1a44394bc76e43a5a81 (patch) | |
tree | a15927f9c6e967a81dcbc774a050e1a6744ecf7b /cddl/contrib | |
parent | 07282103f558b761db70209c5efc2fd1fb705384 (diff) | |
download | src-b539c9bfbd6b551c3899e1a44394bc76e43a5a81.tar.gz src-b539c9bfbd6b551c3899e1a44394bc76e43a5a81.zip |
ZFS: Always refuse receving non-resume stream when resume state exists
This fixes a hole in the situation where the resume state is left from
receiving a new dataset and, so, the state is set on the dataset itself
(as opposed to %recv child).
Additionally, distinguish incremental and resume streams in error
messages.
This was also committed to ZoL:
zfsonlinux/zfs@ebeb6f23bf7e8fe6732a05267ed1cab4c38d3b23
MFC after: 2 weeks
Sponsored by: CyberSecure
Notes
Notes:
svn path=/head/; revision=351803
Diffstat (limited to 'cddl/contrib')
-rw-r--r-- | cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c | 15 |
1 files changed, 11 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 3b87c6910b2b..b7e624e4621c 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c @@ -3278,11 +3278,18 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap, } } else { /* - * if the fs does not exist, look for it based on the - * fromsnap GUID + * If the fs does not exist, look for it based on the + * fromsnap GUID. */ - (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, - "cannot receive incremental stream")); + if (resuming) { + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot receive resume stream")); + } else { + (void) snprintf(errbuf, sizeof (errbuf), + dgettext(TEXT_DOMAIN, + "cannot receive incremental stream")); + } (void) strcpy(zc.zc_name, zc.zc_value); *strchr(zc.zc_name, '@') = '\0'; |