Browse Source

ensure correct file size when opening existing files

pull/1273/head
Chris Lu 5 years ago
parent
commit
6630541399
  1. 6
      weed/filesys/filehandle.go

6
weed/filesys/filehandle.go

@ -33,12 +33,16 @@ type FileHandle struct {
} }
func newFileHandle(file *File, uid, gid uint32) *FileHandle { func newFileHandle(file *File, uid, gid uint32) *FileHandle {
return &FileHandle{
fh := &FileHandle{
f: file, f: file,
dirtyPages: newDirtyPages(file), dirtyPages: newDirtyPages(file),
Uid: uid, Uid: uid,
Gid: gid, Gid: gid,
} }
if fh.f.entry != nil {
fh.f.entry.Attributes.FileSize = filer2.TotalSize(fh.f.entry.Chunks)
}
return fh
} }
var _ = fs.Handle(&FileHandle{}) var _ = fs.Handle(&FileHandle{})

Loading…
Cancel
Save