Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // sameMount reports whether childInfo and parentInfo describe
- // the same file or directory in the same mount. For example,
- // on Unix this means that the device fields of the two underlying
- // structures are identical; on other systems the decision may
- // be based on the path names. sameMount only applies to results
- // returned by os.Stat. It returns false in other cases.
- func sameMount(childInfo os.FileInfo, childPath string, parentInfo os.FileInfo, parentPath string) bool {
- if childInfo == nil || parentInfo == nil {
- return false
- }
- if childPath == "" || parentPath == "" {
- return false
- }
- fi1, ok1 := childInfo.Sys().(*syscall.Stat_t)
- fi2, ok2 := parentInfo.Sys().(*syscall.Stat_t)
- if !ok1 || !ok2 {
- return false
- }
- return fi1.Dev == fi2.Dev
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement