"path/filepath"
"github.com/dustin/go-humanize"
- "go.cypherpunks.ru/nncp/v7"
+ "go.cypherpunks.ru/nncp/v8"
)
func usage() {
goto Tx
}
fis, err = dir.Readdir(0)
- dir.Close() // #nosec G104
+ dir.Close()
if err != nil {
ctx.LogE("xfer-self-read", les, err, func(les nncp.LEs) string {
return logMsg(les) + ": reading"
continue
}
fisInt, err := dir.Readdir(0)
- dir.Close() // #nosec G104
+ dir.Close()
if err != nil {
ctx.LogE("xfer-rx-read", les, err, func(les nncp.LEs) string {
return logMsg(les) + ": reading"
return logMsg(les) + ": not valid packet: " + err.Error()
},
)
- fd.Close() // #nosec G104
+ fd.Close()
continue
}
if pktEnc.Nice > nice {
ctx.LogD("xfer-rx-too-nice", les, func(les nncp.LEs) string {
return logMsg(les) + ": too nice"
})
- fd.Close() // #nosec G104
+ fd.Close()
continue
}
les = append(les, nncp.LE{K: "Size", V: fiInt.Size()})
}
if !ctx.IsEnoughSpace(fiInt.Size()) {
ctx.LogE("xfer-rx", les, errors.New("is not enough space"), logMsg)
- fd.Close() // #nosec G104
+ fd.Close()
continue
}
if _, err = fd.Seek(0, 0); err != nil {
}
if err != nil {
ctx.LogE("xfer-rx", les, err, logMsg)
- w.CloseWithError(err) // #nosec G104
+ w.CloseWithError(err)
}
}()
if _, err = nncp.CopyProgressed(
ctx.LogE("xfer-rx", les, err, logMsg)
isBad = true
}
- fd.Close() // #nosec G104
+ fd.Close()
if isBad {
tmp.Cancel()
continue
})
continue
}
- if _, err = os.Stat(filepath.Join(dstPath, pktName+nncp.SeenSuffix)); err == nil || !os.IsNotExist(err) {
+ if _, err = os.Stat(filepath.Join(
+ dstPath, nncp.SeenDir, pktName,
+ )); err == nil || !os.IsNotExist(err) {
ctx.LogD("xfer-tx-seen", les, func(les nncp.LEs) string {
return logMsg(les) + ": already seen"
})
ctx.LogE("xfer-tx-open", les, err, func(les nncp.LEs) string {
return logMsg(les) + ": opening"
})
- tmp.Close() // #nosec G104
+ tmp.Close()
isBad = true
continue
}
append(les, nncp.LE{K: "FullSize", V: job.Size}),
ctx.ShowPrgrs,
)
- fd.Close() // #nosec G104
+ fd.Close()
if err != nil {
ctx.LogE("xfer-tx-copy", les, err, func(les nncp.LEs) string {
return logMsg(les) + ": copying"
})
- tmp.Close() // #nosec G104
+ tmp.Close()
isBad = true
continue
}
if err = bufW.Flush(); err != nil {
- tmp.Close() // #nosec G104
+ tmp.Close()
ctx.LogE("xfer-tx-flush", les, err, func(les nncp.LEs) string {
return logMsg(les) + ": flushing"
})
continue
}
if err = tmp.Sync(); err != nil {
- tmp.Close() // #nosec G104
+ tmp.Close()
ctx.LogE("xfer-tx-sync", les, err, func(les nncp.LEs) string {
return logMsg(les) + ": syncing"
})
isBad = true
continue
}
- os.Remove(filepath.Join(dstPath, pktName+".part")) // #nosec G104
+ os.Remove(filepath.Join(dstPath, pktName+".part"))
les = les[:len(les)-1]
ctx.LogI(
"xfer-tx",
})
isBad = true
} else if ctx.HdrUsage {
- os.Remove(job.Path + nncp.HdrSuffix)
+ os.Remove(nncp.JobPath2Hdr(job.Path))
}
}
}