mirror of
https://github.com/containers/podman.git
synced 2025-07-04 10:10:32 +08:00
system: avoid reading pause pid file
we already know the path to the pause PID file, no need to calculate it again. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -12,7 +12,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/containers/common/pkg/config"
|
"github.com/containers/common/pkg/config"
|
||||||
"github.com/containers/podman/v3/libpod"
|
|
||||||
"github.com/containers/podman/v3/libpod/define"
|
"github.com/containers/podman/v3/libpod/define"
|
||||||
"github.com/containers/podman/v3/pkg/cgroups"
|
"github.com/containers/podman/v3/pkg/cgroups"
|
||||||
"github.com/containers/podman/v3/pkg/domain/entities"
|
"github.com/containers/podman/v3/pkg/domain/entities"
|
||||||
@ -121,7 +120,7 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, noMoveProcess bool)
|
|||||||
|
|
||||||
became, ret, err = rootless.TryJoinFromFilePaths(pausePidPath, true, paths)
|
became, ret, err = rootless.TryJoinFromFilePaths(pausePidPath, true, paths)
|
||||||
|
|
||||||
if err := movePauseProcessToScope(ic.Libpod); err != nil {
|
if err := movePauseProcessToScope(pausePidPath); err != nil {
|
||||||
conf, err2 := ic.Config(context.Background())
|
conf, err2 := ic.Config(context.Background())
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
return err
|
return err
|
||||||
@ -142,15 +141,7 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, noMoveProcess bool)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func movePauseProcessToScope(r *libpod.Runtime) error {
|
func movePauseProcessToScope(pausePidPath string) error {
|
||||||
tmpDir, err := r.TmpDir()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
pausePidPath, err := util.GetRootlessPauseProcessPidPathGivenDir(tmpDir)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrapf(err, "could not get pause process pid file path")
|
|
||||||
}
|
|
||||||
data, err := ioutil.ReadFile(pausePidPath)
|
data, err := ioutil.ReadFile(pausePidPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrapf(err, "cannot read pause pid file")
|
return errors.Wrapf(err, "cannot read pause pid file")
|
||||||
|
Reference in New Issue
Block a user