summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpod/container_internal.go4
-rw-r--r--libpod/container_internal_linux.go4
-rw-r--r--libpod/container_internal_unsupported.go4
3 files changed, 10 insertions, 2 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 2d08b56f8..60fb29607 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1545,7 +1545,7 @@ func (c *Container) mountStorage() (_ string, deferredErr error) {
rootUID, rootGID := c.RootUID(), c.RootGID()
- dirfd, err := unix.Open(mountPoint, unix.O_RDONLY|unix.O_PATH, 0)
+ dirfd, err := openDirectory(mountPoint)
if err != nil {
return "", fmt.Errorf("open mount point: %w", err)
}
@@ -1568,7 +1568,7 @@ func (c *Container) mountStorage() (_ string, deferredErr error) {
return "", fmt.Errorf("resolve /etc in the container: %w", err)
}
- etcInTheContainerFd, err := unix.Open(etcInTheContainerPath, unix.O_RDONLY|unix.O_PATH, 0)
+ etcInTheContainerFd, err := openDirectory(etcInTheContainerPath)
if err != nil {
return "", fmt.Errorf("open /etc in the container: %w", err)
}
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 6000c2cdd..5c5fd471b 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -3249,3 +3249,7 @@ func (c *Container) setupRootlessNetwork() error {
}
return nil
}
+
+func openDirectory(path string) (fd int, err error) {
+ return unix.Open(path, unix.O_RDONLY|unix.O_PATH, 0)
+}
diff --git a/libpod/container_internal_unsupported.go b/libpod/container_internal_unsupported.go
index 379be9298..de92ff260 100644
--- a/libpod/container_internal_unsupported.go
+++ b/libpod/container_internal_unsupported.go
@@ -93,3 +93,7 @@ func getLocalhostHostEntry(c *Container) etchosts.HostEntries {
func isRootlessCgroupSet(cgroup string) bool {
return false
}
+
+func openDirectory(path string) (fd int, err error) {
+ return -1, errors.New("unsupported openDirectory")
+}