]> Cypherpunks.ru repositories - goredo.git/blobdiff - dep.go
Fix workability under GNU/Linux and other systems because of different syscall
[goredo.git] / dep.go
diff --git a/dep.go b/dep.go
index a362a3840b5ded3a4b141bd85a8451bc0a624f7e..38d8bb79c200ede2acedeb9ce357fe313211d7c2 100644 (file)
--- a/dep.go
+++ b/dep.go
@@ -28,10 +28,10 @@ import (
        "os"
        "path"
        "strings"
-       "syscall"
 
        "go.cypherpunks.ru/recfile"
        "golang.org/x/crypto/blake2b"
+       "golang.org/x/sys/unix"
 )
 
 func recfileWrite(fdDep *os.File, fields ...recfile.Field) error {
@@ -74,12 +74,11 @@ func stamp(fdDep, src *os.File) error {
 }
 
 func fileCtime(fd *os.File) (string, error) {
-       fi, err := fd.Stat()
-       if err != nil {
+       var stat unix.Stat_t
+       if err := unix.Fstat(int(fd.Fd()), &stat); err != nil {
                return "", err
        }
-       stat := fi.Sys().(*syscall.Stat_t)
-       sec, nsec := stat.Ctimespec.Unix()
+       sec, nsec := stat.Ctim.Unix()
        return fmt.Sprintf("%d.%d", sec, nsec), nil
 }