mirror of
https://github.com/containers/podman.git
synced 2025-06-23 02:18:13 +08:00
rootless: report the correct error
do not shadow the err variable so that the correct error message can be reported when utils.RunUnderSystemdScope fails. Closes: https://github.com/containers/libpod/issues/4012 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -178,9 +178,9 @@ func setupRootless(cmd *cobra.Command, args []string) error {
|
|||||||
if !ownsCgroup {
|
if !ownsCgroup {
|
||||||
unitName := fmt.Sprintf("podman-%d.scope", os.Getpid())
|
unitName := fmt.Sprintf("podman-%d.scope", os.Getpid())
|
||||||
if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil {
|
if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil {
|
||||||
conf, err := runtime.GetConfig()
|
conf, err2 := runtime.GetConfig()
|
||||||
if err != nil {
|
if err2 != nil {
|
||||||
return err
|
return err2
|
||||||
}
|
}
|
||||||
if conf.CgroupManager == libpod.SystemdCgroupsManager {
|
if conf.CgroupManager == libpod.SystemdCgroupsManager {
|
||||||
logrus.Warnf("Failed to add podman to systemd sandbox cgroup: %v", err)
|
logrus.Warnf("Failed to add podman to systemd sandbox cgroup: %v", err)
|
||||||
|
Reference in New Issue
Block a user