summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_sendrecv.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/libzfs/libzfs_sendrecv.c b/lib/libzfs/libzfs_sendrecv.c
index a944cc164..899cc84cf 100644
--- a/lib/libzfs/libzfs_sendrecv.c
+++ b/lib/libzfs/libzfs_sendrecv.c
@@ -2144,6 +2144,23 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
return (zfs_error(zhp->zfs_hdl, EZFS_NOENT, errbuf));
}
+ if (fromsnap) {
+ char full_fromsnap_name[ZFS_MAX_DATASET_NAME_LEN];
+ if (snprintf(full_fromsnap_name, sizeof (full_fromsnap_name),
+ "%s@%s", zhp->zfs_name, fromsnap) >=
+ sizeof (full_fromsnap_name)) {
+ err = EINVAL;
+ goto stderr_out;
+ }
+ zfs_handle_t *fromsnapn = zfs_open(zhp->zfs_hdl,
+ full_fromsnap_name, ZFS_TYPE_SNAPSHOT);
+ if (fromsnapn == NULL) {
+ err = -1;
+ goto err_out;
+ }
+ zfs_close(fromsnapn);
+ }
+
if (flags->replicate || flags->doall || flags->props ||
flags->holds || flags->backup) {
char full_tosnap_name[ZFS_MAX_DATASET_NAME_LEN];