]> granicus.if.org Git - zfs/commitdiff
Fix 'zfs receive -F' message when destination has snapshots
authorloli10K <loli10K@users.noreply.github.com>
Wed, 5 Dec 2018 17:33:52 +0000 (18:33 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 5 Dec 2018 17:33:52 +0000 (09:33 -0800)
When receiving a send stream with forced rollback on a dataset with
snapshots zfs suggests said snapshots must be removed to successfully
receive the stream; however the message is misleading because it
prints the dataset name instead of one of its snapshots.

   $ sudo zfs snap pp/recvfs@snap-orig
   $ sudo zfs recv -F pp/recvfs < sendstream
   cannot receive new filesystem stream: destination has snapshots (eg. pp/recvfs)
   must destroy them to overwrite it

This change simply restores the snapshot name in the error message.

Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Closes #8167

lib/libzfs/libzfs_sendrecv.c

index 710bc191287a3a7232b5093bb36567bdef78c291..a05ccbe30960ee9babafb7b59e8c452a5813adc9 100644 (file)
@@ -3930,7 +3930,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const char *tosnap,
                                zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
                                    "destination has snapshots (eg. %s)\n"
                                    "must destroy them to overwrite it"),
-                                   name);
+                                   zc.zc_name);
                                err = zfs_error(hdl, EZFS_EXISTS, errbuf);
                                goto out;
                        }