Skip to content

Commit a7f992c

Browse files
committed
fs: don't convert syscall.Timespec to unix.Timespec directly
This doesn't work with gccgo. vendor/github.com/containerd/continuity/fs/copy_linux.go:54:43: error: invalid type conversion (cannot use type syscall.Timespec as type unix.Timespec) 54 | timespec := []unix.Timespec{unix.Timespec(StatAtime(st)), unix.Timespec(StatMtime(st))} | ^ vendor/github.com/containerd/continuity/fs/copy_linux.go:54:73: error: invalid type conversion (cannot use type syscall.Timespec as type unix.Timespec) 54 | timespec := []unix.Timespec{unix.Timespec(StatAtime(st)), unix.Timespec(StatMtime(st))} | ^ Instead, using an int64 nanosec variable as the bridge. Signed-off-by: Shengjing Zhu <[email protected]>
1 parent 669de92 commit a7f992c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/copy_linux.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ func copyFileInfo(fi os.FileInfo, name string) error {
5151
}
5252
}
5353

54-
timespec := []unix.Timespec{unix.Timespec(StatAtime(st)), unix.Timespec(StatMtime(st))}
54+
timespec := []unix.Timespec{
55+
unix.NsecToTimespec(syscall.TimespecToNsec(StatAtime(st))),
56+
unix.NsecToTimespec(syscall.TimespecToNsec(StatMtime(st))),
57+
}
5558
if err := unix.UtimesNanoAt(unix.AT_FDCWD, name, timespec, unix.AT_SYMLINK_NOFOLLOW); err != nil {
5659
return errors.Wrapf(err, "failed to utime %s", name)
5760
}

0 commit comments

Comments
 (0)