6
"github.com/containers/buildah/copier"
7
"github.com/containers/podman/v5/libpod/define"
10
// statInsideMount stats the specified path *inside* the container's mount and PID
11
// namespace. It returns the file info along with the resolved root ("/") and
12
// the resolved path (relative to the root).
13
func (c *Container) statInsideMount(containerPath string) (*copier.StatForItem, string, string, error) {
15
resolvedPath := c.pathAbs(containerPath)
16
var statInfo *copier.StatForItem
18
err := c.joinMountAndExec(
21
statInfo, statErr = secureStat(resolvedRoot, resolvedPath)
26
return statInfo, resolvedRoot, resolvedPath, err
29
// Calls either statOnHost or statInsideMount depending on whether the
30
// container is running
31
func (c *Container) statInContainer(mountPoint string, containerPath string) (*copier.StatForItem, string, string, error) {
32
if c.state.State == define.ContainerStateRunning {
33
// If the container is running, we need to join it's mount namespace
35
return c.statInsideMount(containerPath)
37
// If the container is NOT running, we need to resolve the path
39
return c.statOnHost(mountPoint, containerPath)