1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-05-20 10:20:00 +02:00

mount: avoid possible index out of bounds error

This commit is contained in:
chrislu 2022-03-04 22:36:01 -08:00
parent 6e49e75a5b
commit da76af187f

View file

@ -183,6 +183,10 @@ func (s *SingleChunkCacher) readChunkAt(buf []byte, offset int64) (int, error) {
s.RLock()
defer s.RUnlock()
return copy(buf, s.data[offset:]), s.err
if s.err != nil {
return 0, s.err
}
return copy(buf, s.data[offset:]), nil
}