Skip to content

Commit 0ec5967

Browse files
authored
Merge pull request #148 from zhsj/fix-gccgo
fs: don't convert syscall.Timespec to unix.Timespec directly
2 parents 669de92 + a7f992c commit 0ec5967

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)