feat(优化代码): 优化代码

This commit is contained in:
2026-01-28 20:58:12 +08:00
parent 7fd47e86cd
commit 6346f92706
+6 -4
View File
@@ -41,8 +41,8 @@ func errno(err error) int {
if err == nil { if err == nil {
return 0 return 0
} }
if errno, ok := err.(syscall.Errno); ok { if sysErr, ok := err.(syscall.Errno); ok {
return -int(errno) return -int(sysErr)
} }
return -int(fuse.ENOENT) return -int(fuse.ENOENT)
} }
@@ -164,11 +164,13 @@ func (s *SymFS) Chown(path string, uid uint32, gid uint32) int {
// 入参: path 路径, tmsp 时间戳数组 // 入参: path 路径, tmsp 时间戳数组
// 返回: int 错误码 // 返回: int 错误码
func (s *SymFS) Utimens(path string, tmsp []fuse.Timespec) int { func (s *SymFS) Utimens(path string, tmsp []fuse.Timespec) int {
if len(tmsp) < 2 {
return -int(fuse.EINVAL)
}
path = s.realPath(path) path = s.realPath(path)
atime := time.Unix(tmsp[0].Sec, tmsp[0].Nsec) atime := time.Unix(tmsp[0].Sec, tmsp[0].Nsec)
mtime := time.Unix(tmsp[1].Sec, tmsp[1].Nsec) mtime := time.Unix(tmsp[1].Sec, tmsp[1].Nsec)
err := os.Chtimes(path, atime, mtime) return errno(os.Chtimes(path, atime, mtime))
return errno(err)
} }
// Access 检查文件访问权限 // Access 检查文件访问权限