aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs/libzfs_sendrecv.c
diff options
context:
space:
mode:
authorAndriy Gapon <[email protected]>2019-09-03 20:56:55 +0300
committerBrian Behlendorf <[email protected]>2019-09-03 10:56:55 -0700
commitebeb6f23bf7e8fe6732a05267ed1cab4c38d3b23 (patch)
treecaa4d1dddd3c3b60a1e614c7b134876b1afa2979 /lib/libzfs/libzfs_sendrecv.c
parent1a504d27df4657d394d9a924c2e7796b692ff993 (diff)
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. Reviewed-by: Matt Ahrens <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Andriy Gapon <[email protected]> Closes #9252
Diffstat (limited to 'lib/libzfs/libzfs_sendrecv.c')
-rw-r--r--lib/libzfs/libzfs_sendrecv.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
index c178296f6..e63404b8a 100644
--- a/lib/libzfs/libzfs_sendrecv.c
+++ b/lib/libzfs/libzfs_sendrecv.c
@@ -4598,11 +4598,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(name, destsnap);
*strchr(name, '@') = '\0';