-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource_unix.go
More file actions
21 lines (18 loc) · 666 Bytes
/
Copy pathsource_unix.go
File metadata and controls
21 lines (18 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//go:build unix
package waxlabel
import (
"os"
"syscall"
)
// sysInodeDevice returns a file's inode and device numbers from the Unix stat
// result, strengthening the save-back identity check (so a file replaced by a
// same-size, same-mtime copy is still detected). Platforms without a
// syscall.Stat_t (Windows, plan9, wasm) use the !unix stub, which returns zeros;
// Identity.Matches treats a zero inode as "unavailable" and falls back to
// size/mtime plus the structural fingerprint.
func sysInodeDevice(info os.FileInfo) (inode, device uint64) {
if st, ok := info.Sys().(*syscall.Stat_t); ok {
return uint64(st.Ino), uint64(st.Dev)
}
return 0, 0
}