mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
40b77af234
Signed-off-by: Darren Stahl <darst@microsoft.com>
26 lines
728 B
Go
26 lines
728 B
Go
package system
|
|
|
|
import (
|
|
"syscall"
|
|
"unsafe"
|
|
)
|
|
|
|
// LUtimesNano is used to change access and modification time of the speficied path.
|
|
// It's used for symbol link file because syscall.UtimesNano doesn't support a NOFOLLOW flag atm.
|
|
func LUtimesNano(path string, ts []syscall.Timespec) error {
|
|
// These are not currently available in syscall
|
|
atFdCwd := -100
|
|
atSymLinkNoFollow := 0x100
|
|
|
|
var _path *byte
|
|
_path, err := syscall.BytePtrFromString(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if _, _, err := syscall.Syscall6(syscall.SYS_UTIMENSAT, uintptr(atFdCwd), uintptr(unsafe.Pointer(_path)), uintptr(unsafe.Pointer(&ts[0])), uintptr(atSymLinkNoFollow), 0, 0); err != 0 && err != syscall.ENOSYS {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|