Commit 397fa2e1 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Use os.FileInfo IsDirectory()/IsRegular.

parent 03784884
......@@ -61,7 +61,7 @@ func (me *FileSystemConnector) internalLookupWithNode(parent *inode, name string
return nil, err, nil
}
data := me.lookupUpdate(parent, name, fi.Mode&S_IFDIR != 0)
data := me.lookupUpdate(parent, name, fi.IsDirectory())
data.LookupCount += lookupCount
out = &EntryOut{
......
......@@ -256,7 +256,7 @@ func (me *UnionFs) Rmdir(path string) (code fuse.Status) {
if r.code != fuse.OK {
return r.code
}
if r.attr.Mode&fuse.S_IFDIR == 0 {
if !r.attr.IsDirectory() {
return syscall.ENOTDIR
}
if r.branch > 0 {
......@@ -450,7 +450,7 @@ func (me *UnionFs) Readlink(name string) (out string, code fuse.Status) {
func IsDir(fs fuse.FileSystem, name string) bool {
a, code := fs.GetAttr(name)
return code.Ok() && a.Mode&fuse.S_IFDIR != 0
return code.Ok() && a.IsDirectory()
}
func stripSlash(fn string) string {
......@@ -469,7 +469,7 @@ func (me *UnionFs) promoteDirsTo(filename string) fuse.Status {
if r.code != fuse.OK {
log.Println("path component does not exist", filename, dirName)
}
if r.attr.Mode&fuse.S_IFDIR == 0 {
if !r.attr.IsDirectory() {
log.Println("path component is not a directory.", dirName, r)
return fuse.EPERM
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment