Merge pull request #6493 from vieux/fix_cp_mac_os
allow utimes on mac os, only lutimes isn't supported
This commit is contained in:
commit
abda245ddc
|
@ -262,11 +262,11 @@ func createTarFile(path, extractDir string, hdr *tar.Header, reader io.Reader, L
|
||||||
ts := []syscall.Timespec{timeToTimespec(hdr.AccessTime), timeToTimespec(hdr.ModTime)}
|
ts := []syscall.Timespec{timeToTimespec(hdr.AccessTime), timeToTimespec(hdr.ModTime)}
|
||||||
// syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and
|
// syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and
|
||||||
if hdr.Typeflag != tar.TypeSymlink {
|
if hdr.Typeflag != tar.TypeSymlink {
|
||||||
if err := system.UtimesNano(path, ts); err != nil {
|
if err := system.UtimesNano(path, ts); err != nil && err != system.ErrNotSupportedPlatform {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := system.LUtimesNano(path, ts); err != nil {
|
if err := system.LUtimesNano(path, ts); err != nil && err != system.ErrNotSupportedPlatform {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package system
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
func LUtimesNano(path string, ts []syscall.Timespec) error {
|
||||||
|
return ErrNotSupportedPlatform
|
||||||
|
}
|
||||||
|
|
||||||
|
func UtimesNano(path string, ts []syscall.Timespec) error {
|
||||||
|
return syscall.UtimesNano(path, ts)
|
||||||
|
}
|
|
@ -24,8 +24,5 @@ func LUtimesNano(path string, ts []syscall.Timespec) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func UtimesNano(path string, ts []syscall.Timespec) error {
|
func UtimesNano(path string, ts []syscall.Timespec) error {
|
||||||
if err := syscall.UtimesNano(path, ts); err != nil {
|
return syscall.UtimesNano(path, ts)
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// +build !linux,!freebsd
|
// +build !linux,!freebsd,!darwin
|
||||||
|
|
||||||
package system
|
package system
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue