continue
}
pipeR, pipeW := io.Pipe()
- errs := make(chan error, 1)
- go func(job Job) {
+ go func(job Job) error {
pipeWB := bufio.NewWriter(pipeW)
_, _, err := PktEncRead(
ctx.Self,
bufio.NewReader(job.Fd),
pipeWB,
)
- errs <- err
- pipeWB.Flush()
- pipeW.Close()
- job.Fd.Close()
+ job.Fd.Close() // #nosec G104
if err != nil {
ctx.LogE("rx", sds, err, "decryption")
+ return pipeW.CloseWithError(err)
}
+ if err = pipeWB.Flush(); err != nil {
+ ctx.LogE("rx", sds, err, "decryption flush")
+ return pipeW.CloseWithError(err)
+ }
+ return pipeW.Close()
}(job)
var pkt Pkt
var err error
cmd.Stdin = newNotification(notify, fmt.Sprintf(
"Exec from %s: %s", sender.Name, argsStr,
), output)
- cmd.Run()
+ if err = cmd.Run(); err != nil {
+ ctx.LogE("rx", sds, err, "notify")
+ }
}
}
}
isBad = true
goto Closing
}
- tmp.Close()
+ if err = tmp.Close(); err != nil {
+ ctx.LogE("rx", sds, err, "copy")
+ isBad = true
+ goto Closing
+ }
dstPathOrig := filepath.Join(*incoming, dst)
dstPath := dstPathOrig
dstPathCtr := 0
dst,
humanize.IBytes(uint64(pktSize)),
), nil)
- cmd.Run()
+ if err = cmd.Run(); err != nil {
+ ctx.LogE("rx", sds, err, "notify")
+ }
}
}
case PktTypeFreq:
cmd.Stdin = newNotification(ctx.NotifyFreq, fmt.Sprintf(
"Freq from %s: %s", sender.Name, src,
), nil)
- cmd.Run()
+ if err = cmd.Run(); err != nil {
+ ctx.LogE("rx", sds, err, "notify")
+ }
}
}
case PktTypeTrns: