Browse Source

mount: avoid use uint64 for greater than zero test

pull/1189/head
Chris Lu 5 years ago
parent
commit
2f75264ec7
  1. 7
      weed/filesys/file.go

7
weed/filesys/file.go

@ -108,10 +108,11 @@ func (file *File) Setattr(ctx context.Context, req *fuse.SetattrRequest, resp *f
// fmt.Printf("truncate %v \n", fullPath) // fmt.Printf("truncate %v \n", fullPath)
var chunks []*filer_pb.FileChunk var chunks []*filer_pb.FileChunk
for _, chunk := range file.entry.Chunks { for _, chunk := range file.entry.Chunks {
if uint64(chunk.Offset)+chunk.Size > req.Size {
chunk.Size = req.Size - uint64(chunk.Offset)
int64Size := int64(chunk.Size)
if chunk.Offset+int64Size > int64(req.Size) {
int64Size = int64(req.Size) - chunk.Offset
} }
if chunk.Size > 0 {
if int64Size > 0 {
chunks = append(chunks, chunk) chunks = append(chunks, chunk)
} }
} }

Loading…
Cancel
Save