From ae3c05aa3770093795ad53bfdf52af380946c951 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Wed, 17 Oct 2018 23:52:18 +0100 Subject: [PATCH] Avoid printing i/o closed pipe error message (#6654) Since refactoring to GetObjectNInfo style, there are many cases when i/o closed pipe is printed like, downloading an object with wrong encryption key. This PR removes the log. --- cmd/erasure-utils.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/erasure-utils.go b/cmd/erasure-utils.go index 411c6751e..524e58f40 100644 --- a/cmd/erasure-utils.go +++ b/cmd/erasure-utils.go @@ -20,7 +20,6 @@ import ( "bytes" "context" "io" - "strings" "github.com/klauspost/reedsolomon" "github.com/minio/minio/cmd/logger" @@ -82,7 +81,9 @@ func writeDataBlocks(ctx context.Context, dst io.Writer, enBlocks [][]byte, data if write < int64(len(block)) { n, err := io.Copy(dst, bytes.NewReader(block[:write])) if err != nil { - logger.LogIf(ctx, err) + if err != io.ErrClosedPipe { + logger.LogIf(ctx, err) + } return 0, err } totalWritten += n @@ -92,7 +93,7 @@ func writeDataBlocks(ctx context.Context, dst io.Writer, enBlocks [][]byte, data n, err := io.Copy(dst, bytes.NewReader(block)) if err != nil { // The writer will be closed incase of range queries, which will emit ErrClosedPipe. - if !strings.Contains(err.Error(), "read/write on closed pipe") { + if err != io.ErrClosedPipe { logger.LogIf(ctx, err) } return 0, err