1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-07 17:47:14 +00:00

Remove unreachable code, and don't leak contexts

This patch performs some minor cleanups for things detected by "go vet":

 - Remove one line of unreachable code.
 - Don't leak contexts until their deadline expires, cancel them.
This commit is contained in:
Alberto Bertogli
2016-09-25 22:02:08 +01:00
parent 0995eac474
commit 04dd8b9534
3 changed files with 4 additions and 4 deletions

View File

@@ -51,8 +51,9 @@ func (p *Procmail) Deliver(from string, to string, data []byte) (error, bool) {
args = append(args, replacer.Replace(a))
}
ctx, _ := context.WithDeadline(context.Background(),
ctx, cancel := context.WithDeadline(context.Background(),
time.Now().Add(p.Timeout))
defer cancel()
cmd := exec.CommandContext(ctx, p.Binary, args...)
cmdStdin, err := cmd.StdinPipe()