From bcd0988597ca262a56ea0459cdcbf79647662731 Mon Sep 17 00:00:00 2001 From: Faruk Kasumovic Date: Wed, 15 Aug 2018 20:23:12 +0200 Subject: [PATCH] Fix problem with from snapshot name interpretation on incremental syncs --- sendrecv.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/sendrecv.go b/sendrecv.go index ed6963b..0bc5cf0 100644 --- a/sendrecv.go +++ b/sendrecv.go @@ -101,15 +101,20 @@ func (d *Dataset) send(FromName string, outf *os.File, flags *SendFlags) (err er if dpath, err = d.Path(); err != nil { return } + sendparams := strings.Split(dpath, "@") + parent := sendparams[0] if len(FromName) > 0 { - if FromName[0] == '#' || FromName[0] == '@' { - FromName = dpath + FromName + if FromName[0] == '@' { + FromName = FromName[1:] + } else if strings.Contains(FromName, "/") { + from := strings.Split(FromName, "@") + if len(from) > 0 { + FromName = from[1] + } } cfromname = C.CString(FromName) defer C.free(unsafe.Pointer(cfromname)) } - sendparams := strings.Split(dpath, "@") - parent := sendparams[0] ctoname = C.CString(sendparams[1]) defer C.free(unsafe.Pointer(ctoname)) if pd, err = DatasetOpen(parent); err != nil { @@ -200,7 +205,7 @@ func (d *Dataset) SendFrom(FromName string, outf *os.File, flags SendFlags) (err return } } - err = d.send(from[1], outf, &flags) + err = d.send("@"+from[1], outf, &flags) return }