diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-07-18 07:32:14 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-18 07:32:14 +0000 |
commit | 5201ea8e4176dfc6cfd2816e5cf1c3fa0adf9587 (patch) | |
tree | cfdb6a9d9a2f56693d2f84efa4ed44dda8f4befe | |
parent | b680e117bacd6436b50a243ad7da4ebe3fc0bdf3 (diff) | |
parent | bb8ff86bf2447bbb1ce96b1371b1e7510835d2ff (diff) | |
download | podman-5201ea8e4176dfc6cfd2816e5cf1c3fa0adf9587.tar.gz podman-5201ea8e4176dfc6cfd2816e5cf1c3fa0adf9587.tar.bz2 podman-5201ea8e4176dfc6cfd2816e5cf1c3fa0adf9587.zip |
Merge pull request #14777 from rhatdan/nfs
Use SafeChown rather then chown for volumes on NFS
-rw-r--r-- | libpod/runtime_volume_linux.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libpod/runtime_volume_linux.go b/libpod/runtime_volume_linux.go index d2fe9f2fb..1f354e41b 100644 --- a/libpod/runtime_volume_linux.go +++ b/libpod/runtime_volume_linux.go @@ -16,6 +16,7 @@ import ( "github.com/containers/podman/v4/libpod/events" volplugin "github.com/containers/podman/v4/libpod/plugin" "github.com/containers/storage/drivers/quota" + "github.com/containers/storage/pkg/idtools" "github.com/containers/storage/pkg/stringid" pluginapi "github.com/docker/go-plugins-helpers/volume" "github.com/sirupsen/logrus" @@ -101,14 +102,14 @@ func (r *Runtime) newVolume(noCreatePluginVolume bool, options ...VolumeCreateOp if err := os.MkdirAll(volPathRoot, 0700); err != nil { return nil, fmt.Errorf("creating volume directory %q: %w", volPathRoot, err) } - if err := os.Chown(volPathRoot, volume.config.UID, volume.config.GID); err != nil { + if err := idtools.SafeChown(volPathRoot, volume.config.UID, volume.config.GID); err != nil { return nil, fmt.Errorf("chowning volume directory %q to %d:%d: %w", volPathRoot, volume.config.UID, volume.config.GID, err) } fullVolPath := filepath.Join(volPathRoot, "_data") if err := os.MkdirAll(fullVolPath, 0755); err != nil { return nil, fmt.Errorf("creating volume directory %q: %w", fullVolPath, err) } - if err := os.Chown(fullVolPath, volume.config.UID, volume.config.GID); err != nil { + if err := idtools.SafeChown(fullVolPath, volume.config.UID, volume.config.GID); err != nil { return nil, fmt.Errorf("chowning volume directory %q to %d:%d: %w", fullVolPath, volume.config.UID, volume.config.GID, err) } if err := LabelVolumePath(fullVolPath); err != nil { |