aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/lib
diff options
context:
space:
mode:
authorAndriy Gapon <avg@FreeBSD.org>2019-09-04 07:33:22 +0000
committerAndriy Gapon <avg@FreeBSD.org>2019-09-04 07:33:22 +0000
commitb539c9bfbd6b551c3899e1a44394bc76e43a5a81 (patch)
treea15927f9c6e967a81dcbc774a050e1a6744ecf7b /cddl/contrib/opensolaris/lib
parent07282103f558b761db70209c5efc2fd1fb705384 (diff)
downloadsrc-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/opensolaris/lib')
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c15
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';