mirror of
https://github.com/restic/restic.git
synced 2025-03-16 00:00:05 +01:00
changed stat
This commit is contained in:
parent
ce90a281fd
commit
99a3e19661
3 changed files with 14 additions and 12 deletions
|
@ -35,21 +35,10 @@ func walkDir(dir string) <-chan *dirEntry {
|
|||
return nil
|
||||
}
|
||||
|
||||
links := 1
|
||||
if runtime.GOOS != "windows" {
|
||||
stat, ok := restic.ToStatT(info.Sys())
|
||||
|
||||
if !ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
links = stat.nlink()
|
||||
}
|
||||
|
||||
ch <- &dirEntry{
|
||||
path: name,
|
||||
fi: info,
|
||||
link: links,
|
||||
link: nlink(),
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
"syscall"
|
||||
"restic"
|
||||
)
|
||||
|
||||
func (e *dirEntry) equals(other *dirEntry) bool {
|
||||
|
@ -44,3 +45,11 @@ func (e *dirEntry) equals(other *dirEntry) bool {
|
|||
|
||||
return true
|
||||
}
|
||||
|
||||
func nlink(info os.FileInfo) (uint64, error) {
|
||||
stat, err := restic.ToStatT(info.Sys())
|
||||
if err {
|
||||
return nil, ok
|
||||
}
|
||||
return stat.nlink(info), err
|
||||
}
|
|
@ -25,3 +25,7 @@ func (e *dirEntry) equals(other *dirEntry) bool {
|
|||
|
||||
return true
|
||||
}
|
||||
|
||||
func nlink(info os.FileInfo) (uint64, error) {
|
||||
return 1, err
|
||||
}
|
Loading…
Add table
Reference in a new issue