fix warnings by ineffassign, with a one actual issue

In store/search.go, we would make a copy of a byte array, but then still use
the original instead of the copy. Could result in search operations not finding
messages that do have the content, but under very unlikely conditions only.

We'll keep running ineffassign with "make check", useful enough.
This commit is contained in:
Mechiel Lukkien
2025-03-24 10:19:50 +01:00
parent 04b1f030b7
commit 15a8ce8c0b
8 changed files with 15 additions and 15 deletions

View File

@ -3424,18 +3424,16 @@ func (c *conn) deliver(ctx context.Context, recvHdrFor func(string) string, msgW
return fmt.Errorf("finding rejects mailbox: %v", err)
}
hasSpace := true
if !conf.KeepRejects && mbrej != nil {
var chl []store.Change
chl, hasSpace, err = a.d.acc.TidyRejectsMailbox(c.log, tx, mbrej)
chl, hasSpace, err := a.d.acc.TidyRejectsMailbox(c.log, tx, mbrej)
if err != nil {
return fmt.Errorf("tidying rejects mailbox: %v", err)
}
changes = append(changes, chl...)
if !hasSpace {
log.Info("not storing spammy mail to full rejects mailbox")
return nil
}
changes = append(changes, chl...)
}
if mbrej == nil {
nmb, chl, _, _, err := a.d.acc.MailboxCreate(tx, conf.RejectsMailbox, store.SpecialUse{})