041a9510c6
Save was failing file integrity checksums due to bugs in both Windows and Docker. This commit includes fixes to file time handling in tarexport and system.chtimes that are necessary along with the Windows platform fixes to correctly support save. With this change, sysfile_backups for windowsfilter driver are no longer needed, so that code is removed. Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
27 lines
712 B
Go
27 lines
712 B
Go
// +build windows
|
|
|
|
package system
|
|
|
|
import (
|
|
"syscall"
|
|
"time"
|
|
)
|
|
|
|
//setCTime will set the create time on a file. On Windows, this requires
|
|
//calling SetFileTime and explicitly including the create time.
|
|
func setCTime(path string, ctime time.Time) error {
|
|
ctimespec := syscall.NsecToTimespec(ctime.UnixNano())
|
|
pathp, e := syscall.UTF16PtrFromString(path)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
h, e := syscall.CreateFile(pathp,
|
|
syscall.FILE_WRITE_ATTRIBUTES, syscall.FILE_SHARE_WRITE, nil,
|
|
syscall.OPEN_EXISTING, syscall.FILE_FLAG_BACKUP_SEMANTICS, 0)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
defer syscall.Close(h)
|
|
c := syscall.NsecToFiletime(syscall.TimespecToNsec(ctimespec))
|
|
return syscall.SetFileTime(h, &c, nil, nil)
|
|
}
|