X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Ftx.go;h=77db5928d852daffe12e70b0414da3d2d336c8ec;hb=0ed43747344437800094782e78313b1c41c2cc1c;hp=fd4e0fbdec5182a7f689731de9a3591e15eb80ae;hpb=823e905cef9ef709c264ce7c07945a2f6c8a1c8c;p=nncp.git diff --git a/src/tx.go b/src/tx.go index fd4e0fb..77db592 100644 --- a/src/tx.go +++ b/src/tx.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2021 Sergey Matveev +Copyright (C) 2016-2022 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -211,7 +211,7 @@ func (ctx *Ctx) Tx( r := <-results if r.err != nil { tmp.Fd.Close() - return nil, 0, err + return nil, 0, r.err } if r.pktEncRaw != nil { pktEncRaw = r.pktEncRaw @@ -330,11 +330,11 @@ func prepareTxFile(srcPath string) ( if err != nil { return err } - if info.IsDir() { + if info.Mode().IsDir() { // directory header, PAX record header+contents srcSize += TarBlockSize + 2*TarBlockSize dirs = append(dirs, einfo{path: path, modTime: info.ModTime()}) - } else { + } else if info.Mode().IsRegular() { // file header, PAX record header+contents, file content srcSize += TarBlockSize + 2*TarBlockSize + info.Size() if n := info.Size() % TarBlockSize; n != 0 {