Merge pull request #16490 from Microsoft/10662-mtimefix
Fixed file modified time not changing on windows Upstream-commit: 134fefbaa2b63e337a5ef247111bb5a2733809be Component: engine
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/pkg/system"
|
||||
)
|
||||
@@ -149,13 +150,15 @@ func copyDir(srcDir, dstDir string, flags copyFlags) error {
|
||||
}
|
||||
}
|
||||
|
||||
ts := []syscall.Timespec{stat.Atim, stat.Mtim}
|
||||
// syscall.UtimesNano doesn't support a NOFOLLOW flag atm, and
|
||||
// system.Chtimes doesn't support a NOFOLLOW flag atm
|
||||
if !isSymlink {
|
||||
if err := system.UtimesNano(dstPath, ts); err != nil {
|
||||
aTime := time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec))
|
||||
mTime := time.Unix(int64(stat.Mtim.Sec), int64(stat.Mtim.Nsec))
|
||||
if err := system.Chtimes(dstPath, aTime, mTime); err != nil {
|
||||
return err
|
||||
}
|
||||
} else {
|
||||
ts := []syscall.Timespec{stat.Atim, stat.Mtim}
|
||||
if err := system.LUtimesNano(dstPath, ts); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user