1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/vendor/github.com/tonistiigi/fsutil/copy/mkdir_unix.go
Tonis Tiigi e96d1c3754 vendor: update buildkit to e9aca5be
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-03-20 22:01:23 -07:00

32 lines
510 B
Go

// +build !windows
package fs
import (
"time"
"github.com/pkg/errors"
"golang.org/x/sys/unix"
)
func fixRootDirectory(p string) string {
return p
}
func Utimes(p string, tm *time.Time) error {
if tm == nil {
return nil
}
ts, err := unix.TimeToTimespec(*tm)
if err != nil {
return err
}
timespec := []unix.Timespec{ts, ts}
if err := unix.UtimesNanoAt(unix.AT_FDCWD, p, timespec, unix.AT_SYMLINK_NOFOLLOW); err != nil {
return errors.Wrapf(err, "failed to utime %s", p)
}
return nil
}