Skip to content

Commit

Permalink
Fix cases where we are wrapping a nil error
Browse files Browse the repository at this point in the history
This was using `errors.Wrap` when there was no error to wrap, meanwhile
we are supposed to be creating a new error.

Found this while investigating some log corruption issues and
unexpectedly getting a nil reader and a nil error from `getTailReader`.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
(cherry picked from commit 0a48d26)
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
  • Loading branch information
cpuguy83 authored and vvoland committed Apr 9, 2024
1 parent bed0abf commit 8f67ed8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion daemon/logger/local/read.go
Expand Up @@ -66,7 +66,7 @@ func getTailReader(ctx context.Context, r loggerutils.SizeReaderAt, req int) (io
}

if msgLen != binary.BigEndian.Uint32(buf) {
return nil, 0, errdefs.DataLoss(errors.Wrap(err, "log message header and footer indicate different message sizes"))
return nil, 0, errdefs.DataLoss(errors.New("log message header and footer indicate different message sizes"))
}

found++
Expand Down

0 comments on commit 8f67ed8

Please sign in to comment.