summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-07-12 12:53:55 -0400
committerGitHub <noreply@github.com>2021-07-12 12:53:55 -0400
commit561ef855706e9276cc66d4718db96389f3f32735 (patch)
tree8062e0c7cba3838260fb8950e8ff5328bac15dd9 /libpod
parentf49fd0694dea711ce578c8016dc88607ff71ab12 (diff)
parent6cac65c841bc1b52780d8784c3fcca752d03eb1d (diff)
downloadpodman-561ef855706e9276cc66d4718db96389f3f32735.tar.gz
podman-561ef855706e9276cc66d4718db96389f3f32735.tar.bz2
podman-561ef855706e9276cc66d4718db96389f3f32735.zip
Merge pull request #10905 from matejvasek/fix-mount
fix: uid/gid for volume mounted to existing dir
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal_linux.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 850af235f..b69ad4105 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -2490,6 +2490,11 @@ func (c *Container) fixVolumePermissions(v *ContainerNamedVolume) error {
// https://github.com/containers/podman/issues/10188
st, err := os.Lstat(filepath.Join(c.state.Mountpoint, v.Dest))
if err == nil {
+ if stat, ok := st.Sys().(*syscall.Stat_t); ok {
+ if err := os.Lchown(mountPoint, int(stat.Uid), int(stat.Gid)); err != nil {
+ return err
+ }
+ }
if err := os.Chmod(mountPoint, st.Mode()|0111); err != nil {
return err
}