github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/pkg/system/utimes_unix.go (about) 1 // +build linux freebsd 2 3 package system // import "github.com/demonoid81/moby/pkg/system" 4 5 import ( 6 "syscall" 7 8 "golang.org/x/sys/unix" 9 ) 10 11 // LUtimesNano is used to change access and modification time of the specified path. 12 // It's used for symbol link file because unix.UtimesNano doesn't support a NOFOLLOW flag atm. 13 func LUtimesNano(path string, ts []syscall.Timespec) error { 14 uts := []unix.Timespec{ 15 unix.NsecToTimespec(syscall.TimespecToNsec(ts[0])), 16 unix.NsecToTimespec(syscall.TimespecToNsec(ts[1])), 17 } 18 err := unix.UtimesNanoAt(unix.AT_FDCWD, path, uts, unix.AT_SYMLINK_NOFOLLOW) 19 if err != nil && err != unix.ENOSYS { 20 return err 21 } 22 23 return nil 24 }