mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 18:47:57 +08:00
avoid possible nil attributes
This commit is contained in:
@@ -138,18 +138,20 @@ func (wfs *WFS) setAttrByPbEntry(out *fuse.Attr, inode uint64, entry *filer_pb.E
|
|||||||
out.Size = filer.FileSize(entry)
|
out.Size = filer.FileSize(entry)
|
||||||
out.Blocks = (out.Size + blockSize - 1) / blockSize
|
out.Blocks = (out.Size + blockSize - 1) / blockSize
|
||||||
setBlksize(out, blockSize)
|
setBlksize(out, blockSize)
|
||||||
out.Mtime = uint64(entry.Attributes.Mtime)
|
if entry.Attributes != nil {
|
||||||
out.Ctime = uint64(entry.Attributes.Mtime)
|
out.Mtime = uint64(entry.Attributes.Mtime)
|
||||||
out.Atime = uint64(entry.Attributes.Mtime)
|
out.Ctime = uint64(entry.Attributes.Mtime)
|
||||||
out.Mode = toSyscallMode(os.FileMode(entry.Attributes.FileMode))
|
out.Atime = uint64(entry.Attributes.Mtime)
|
||||||
|
out.Mode = toSyscallMode(os.FileMode(entry.Attributes.FileMode))
|
||||||
|
out.Uid = entry.Attributes.Uid
|
||||||
|
out.Gid = entry.Attributes.Gid
|
||||||
|
out.Rdev = entry.Attributes.Rdev
|
||||||
|
}
|
||||||
if entry.HardLinkCounter > 0 {
|
if entry.HardLinkCounter > 0 {
|
||||||
out.Nlink = uint32(entry.HardLinkCounter)
|
out.Nlink = uint32(entry.HardLinkCounter)
|
||||||
} else {
|
} else {
|
||||||
out.Nlink = 1
|
out.Nlink = 1
|
||||||
}
|
}
|
||||||
out.Uid = entry.Attributes.Uid
|
|
||||||
out.Gid = entry.Attributes.Gid
|
|
||||||
out.Rdev = entry.Attributes.Rdev
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (wfs *WFS) setAttrByFilerEntry(out *fuse.Attr, inode uint64, entry *filer.Entry) {
|
func (wfs *WFS) setAttrByFilerEntry(out *fuse.Attr, inode uint64, entry *filer.Entry) {
|
||||||
|
Reference in New Issue
Block a user