Fix #104191: Manager build error on ARM64 #104210

Manually merged
Sybren A. Stüvel merged 1 commits from fix/104191-arm64-build into main 2023-05-26 14:15:28 +02:00
1 changed files with 12 additions and 12 deletions

View File

@ -23,21 +23,21 @@
package touch package touch
import ( import (
"syscall" "os"
"unsafe"
"golang.org/x/sys/unix"
) )
// touch is the same as syscall.utimes, but passes NULL as timestamp pointer (instead of a // touch uses uni.UtimesNano() in order to pass the special 'now' timestamps
// pointer to a concrete time). // available in that package.
func touch(path string) (err error) { func touch(path string) (err error) {
var _p0 *byte now := unix.Timespec{
_p0, err = syscall.BytePtrFromString(path) Sec: 0,
if err != nil { Nsec: unix.UTIME_NOW,
return
} }
_, _, e1 := syscall.Syscall(syscall.SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(0), 0) utimes := []unix.Timespec{now, now}
if e1 != 0 { if e := unix.UtimesNano(path, utimes); e != nil {
err = syscall.Errno(e1) return &os.PathError{Op: "chtimes", Path: path, Err: e}
} }
return return nil
} }