From 4eed89acaa95cc1678bcfee69847e4dfd51290d1 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Wed, 3 Mar 2021 14:37:23 +0100 Subject: Fix possible panic with podman build --iidfile Make sure we check for errors before trying to write the iidfile. [NO TESTS NEEDED] Ref #9594 Signed-off-by: Paul Holzinger --- cmd/podman/images/build.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go index 0e1c47399..de532ed78 100644 --- a/cmd/podman/images/build.go +++ b/cmd/podman/images/build.go @@ -265,6 +265,9 @@ func build(cmd *cobra.Command, args []string) error { } report, err := registry.ImageEngine().Build(registry.GetContext(), containerFiles, *apiBuildOpts) + if err != nil { + return err + } if cmd.Flag("iidfile").Changed { f, err := os.Create(buildOpts.Iidfile) @@ -276,7 +279,7 @@ func build(cmd *cobra.Command, args []string) error { } } - return err + return nil } // buildFlagsWrapperToOptions converts the local build flags to the build options used -- cgit v1.2.3-54-g00ecf