lib/fs: Handle deduplicated files on NTFS (fixes #1845)
These files always have the symlink bit set, because they are reparse points. Nonetheless they are not symlinks, and Lstat reports a size for them. We use this fact to disambiguate, and hope fervently that nothing else matches this description so it comes back to bite us... GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4622
This commit is contained in:
committed by
Audrius Butkevicius
parent
9988044bbe
commit
a9f0659f2f
@@ -322,14 +322,12 @@ type fsFileInfo struct {
|
||||
os.FileInfo
|
||||
}
|
||||
|
||||
func (e fsFileInfo) Mode() FileMode {
|
||||
return FileMode(e.FileInfo.Mode())
|
||||
func (e fsFileInfo) IsSymlink() bool {
|
||||
// Must use fsFileInfo.Mode() because it may apply magic.
|
||||
return e.Mode()&ModeSymlink != 0
|
||||
}
|
||||
|
||||
func (e fsFileInfo) IsRegular() bool {
|
||||
return e.FileInfo.Mode().IsRegular()
|
||||
}
|
||||
|
||||
func (e fsFileInfo) IsSymlink() bool {
|
||||
return e.FileInfo.Mode()&os.ModeSymlink == os.ModeSymlink
|
||||
// Must use fsFileInfo.Mode() because it may apply magic.
|
||||
return e.Mode()&ModeType == 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user