diff --git a/cmd/client-fs.go b/cmd/client-fs.go index df72743e..b0e12d27 100644 --- a/cmd/client-fs.go +++ b/cmd/client-fs.go @@ -241,9 +241,8 @@ func (f *fsClient) Put(reader io.Reader, size int64, contentType string, progres // Current file offset. var currentOffset = partSt.Size() - // Reflect and verify if incoming reader implements ReaderAt. - readerAt, ok := reader.(io.ReaderAt) - if ok { + // Verify if incoming reader implements ReaderAt. Standard IO streams are excluded since their ReadAt() return illegal seek error + if readerAt, ok := reader.(io.ReaderAt); ok && !isStdIO(reader) { // Notify the progress bar if any till current size. if progress != nil { if _, e = io.CopyN(ioutil.Discard, progress, currentOffset); e != nil { diff --git a/cmd/utils.go b/cmd/utils.go index 1db9bde2..4401763d 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -18,7 +18,9 @@ package cmd import ( "crypto/tls" + "io" "math/rand" + "os" "path/filepath" "time" @@ -58,3 +60,8 @@ func dumpTLSCertificates(t *tls.ConnectionState) { console.Debugln(" >> Expires: " + cert.NotAfter.String()) } } + +// isStdIO checks if the input parameter is one of the standard input/output streams +func isStdIO(reader io.Reader) bool { + return reader == os.Stdin || reader == os.Stdout || reader == os.Stderr +}