summaryrefslogtreecommitdiff
path: root/libpod/container_internal_freebsd.go
diff options
context:
space:
mode:
authorDoug Rabson <dfr@rabson.org>2022-08-27 16:34:57 +0100
committerDoug Rabson <dfr@rabson.org>2022-09-05 10:20:50 +0100
commita3aecf0f26971cbf178fc705d0983ee248a6492b (patch)
treef38267d25b040c27a63733e0d4847f53c18150bd /libpod/container_internal_freebsd.go
parent7a1abd03c54791186216f6086c58f0f87c7e4f46 (diff)
downloadpodman-a3aecf0f26971cbf178fc705d0983ee248a6492b.tar.gz
podman-a3aecf0f26971cbf178fc705d0983ee248a6492b.tar.bz2
podman-a3aecf0f26971cbf178fc705d0983ee248a6492b.zip
libpod: Factor out setting volume atime to container_internal_linux.go
It turns out that field names in syscall.Stat_t are platform-specific. An alternative to this could change fixVolumePermissions to use unix.Lstat since unix.Stat_t uses the same mmember name for Atim on both Linux and FreeBSD. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <dfr@rabson.org>
Diffstat (limited to 'libpod/container_internal_freebsd.go')
-rw-r--r--libpod/container_internal_freebsd.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/libpod/container_internal_freebsd.go b/libpod/container_internal_freebsd.go
index c87617848..40c6c5ebf 100644
--- a/libpod/container_internal_freebsd.go
+++ b/libpod/container_internal_freebsd.go
@@ -274,3 +274,12 @@ func (c *Container) isSlirp4netnsIPv6() (bool, error) {
func (c *Container) hasNetNone() bool {
return c.state.NetworkJail == ""
}
+
+func setVolumeAtime(mountPoint string, st os.FileInfo) error {
+ stat := st.Sys().(*syscall.Stat_t)
+ atime := time.Unix(int64(stat.Atimespec.Sec), int64(stat.Atimespec.Nsec)) //nolint: unconvert
+ if err := os.Chtimes(mountPoint, atime, st.ModTime()); err != nil {
+ return err
+ }
+ return nil
+}