aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/containers/buildah/copier/syscall_unix.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/containers/buildah/copier/syscall_unix.go')
-rw-r--r--vendor/github.com/containers/buildah/copier/syscall_unix.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/vendor/github.com/containers/buildah/copier/syscall_unix.go b/vendor/github.com/containers/buildah/copier/syscall_unix.go
index aa40f327c..9fc8fece3 100644
--- a/vendor/github.com/containers/buildah/copier/syscall_unix.go
+++ b/vendor/github.com/containers/buildah/copier/syscall_unix.go
@@ -4,6 +4,7 @@ package copier
import (
"os"
+ "syscall"
"time"
"github.com/pkg/errors"
@@ -73,6 +74,21 @@ func lutimes(isSymlink bool, path string, atime, mtime time.Time) error {
return unix.Lutimes(path, []unix.Timeval{unix.NsecToTimeval(atime.UnixNano()), unix.NsecToTimeval(mtime.UnixNano())})
}
+// sameDevice returns true unless we're sure that they're not on the same device
+func sameDevice(a, b os.FileInfo) bool {
+ aSys := a.Sys()
+ bSys := b.Sys()
+ if aSys == nil || bSys == nil {
+ return true
+ }
+ au, aok := aSys.(*syscall.Stat_t)
+ bu, bok := bSys.(*syscall.Stat_t)
+ if !aok || !bok {
+ return true
+ }
+ return au.Dev == bu.Dev
+}
+
const (
testModeMask = int64(os.ModePerm)
testIgnoreSymlinkDates = false