Open nak3 opened 7 years ago
Current codes check the result of Read or Write like this:
n, err := r.ReadAt(cmd.Buf[:length], int64(offset)) if n < length { log.Errorln("read/read failed: unable to copy enough") return cmd.MediumError(), nil } if err != nil { log.Errorln("read/read failed: error:", err) return cmd.MediumError(), nil }
When Read() and Write() return error, they always make n < length true, and so they return before outputting the error.
Read()
Write()
n < length
Current codes check the result of Read or Write like this:
When
Read()
andWrite()
return error, they always maken < length
true, and so they return before outputting the error.