mirror of
https://github.com/minio/minio.git
synced 2024-12-25 22:55:54 -05:00
posix: parseDirents() should follow symlink and get values. (#1631)
Previously parseDirents() ignores symbolic links. This patch fixes the issue by following the symlink using os.Stat(). Fixes #1545
This commit is contained in:
parent
9e45d138cc
commit
43539a0c86
@ -79,7 +79,9 @@ func parseDirents(dirPath string, buf []byte) (entries []string, err error) {
|
|||||||
entries = append(entries, name+slashSeparator)
|
entries = append(entries, name+slashSeparator)
|
||||||
case syscall.DT_REG:
|
case syscall.DT_REG:
|
||||||
entries = append(entries, name)
|
entries = append(entries, name)
|
||||||
case syscall.DT_UNKNOWN:
|
case syscall.DT_LNK, syscall.DT_UNKNOWN:
|
||||||
|
// If its symbolic link, follow the link using os.Stat()
|
||||||
|
|
||||||
// On Linux XFS does not implement d_type for on disk
|
// On Linux XFS does not implement d_type for on disk
|
||||||
// format << v5. Fall back to Stat().
|
// format << v5. Fall back to Stat().
|
||||||
var fi os.FileInfo
|
var fi os.FileInfo
|
||||||
@ -101,7 +103,6 @@ func parseDirents(dirPath string, buf []byte) (entries []string, err error) {
|
|||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
// Skip entries which are not file or directory.
|
// Skip entries which are not file or directory.
|
||||||
// FIXME: should we handle symlinks?
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user