summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorUrvashi Mohnani <umohnani@redhat.com>2021-06-23 14:24:55 -0400
committerUrvashi Mohnani <umohnani@redhat.com>2021-06-23 14:46:40 -0400
commit9db534e53af884abfbcea2bd0efbbb89ca0b949c (patch)
treea63b756fb6c275817d9a84f51beb135a04f867c6 /libpod
parente50e0dad9055673ef344f756e91387d9bd0c4d90 (diff)
downloadpodman-9db534e53af884abfbcea2bd0efbbb89ca0b949c.tar.gz
podman-9db534e53af884abfbcea2bd0efbbb89ca0b949c.tar.bz2
podman-9db534e53af884abfbcea2bd0efbbb89ca0b949c.zip
[NO TESTS NEEDED] Create /etc/mtab with the correct ownership
Create the /etc and /etc/mtab directories with the correct ownership based on what the UID and GID is for the container. This was causing issue when starting the infra container with userns as the /etc directory wasn't being created with the correct ownership. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 545b78976..2555f15ec 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1535,7 +1535,7 @@ func (c *Container) mountStorage() (_ string, deferredErr error) {
// If /etc/mtab does not exist in container image, then we need to
// create it, so that mount command within the container will work.
mtab := filepath.Join(mountPoint, "/etc/mtab")
- if err := os.MkdirAll(filepath.Dir(mtab), 0755); err != nil {
+ if err := idtools.MkdirAllAs(filepath.Dir(mtab), 0755, c.RootUID(), c.RootGID()); err != nil {
return "", errors.Wrap(err, "error creating mtab directory")
}
if err = os.Symlink("/proc/mounts", mtab); err != nil && !os.IsExist(err) {