From c978cad88b46694d26e57b0804ff0fa2fda57c5e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 2 Aug 2023 10:06:17 -0400 Subject: [PATCH] daemon: Two minor fixes for reexec These two things got lost in the conflict-fest of juggling two branches and an incoming revert. --- pkg/daemon/daemon.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index dcb79908cf..c367fa03ce 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -453,7 +453,7 @@ func ReexecuteForTargetRoot(target string) error { // Otherwise, we assume that there's no suffixing needed. Hopefully // by RHEL10 the MCD will have fundamentally changed and we won't be doing the // chroot() thing anymore. - klog.Info("not chrooting for source=rhel-%s target=rhel-%s", sourceMajor, targetMajor) + klog.Infof("not chrooting for source=rhel-%s target=rhel-%s", sourceMajor, targetMajor) } } else { klog.Info("assuming we can use container binary chroot() to host") @@ -476,6 +476,7 @@ func ReexecuteForTargetRoot(target string) error { if err != nil { return fmt.Errorf("writing %s: %w", targetBin, err) } + defer f.Cleanup() if _, err := io.Copy(f, src); err != nil { f.Close() return fmt.Errorf("writing %s: %w", targetBin, err)