From 466694b881e2494c431172f326738016a63ed263 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 13 Sep 2019 14:58:32 +0200 Subject: 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 --- cmd/podman/main_local.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd/podman/main_local.go') diff --git a/cmd/podman/main_local.go b/cmd/podman/main_local.go index cad256615..08d7ccaf4 100644 --- a/cmd/podman/main_local.go +++ b/cmd/podman/main_local.go @@ -178,9 +178,9 @@ func setupRootless(cmd *cobra.Command, args []string) error { if !ownsCgroup { unitName := fmt.Sprintf("podman-%d.scope", os.Getpid()) if err := utils.RunUnderSystemdScope(os.Getpid(), "user.slice", unitName); err != nil { - conf, err := runtime.GetConfig() - if err != nil { - return err + conf, err2 := runtime.GetConfig() + if err2 != nil { + return err2 } if conf.CgroupManager == libpod.SystemdCgroupsManager { logrus.Warnf("Failed to add podman to systemd sandbox cgroup: %v", err) -- cgit v1.2.3-54-g00ecf