diff options
author | Hironori Shiina <Hironori.Shiina@fujitsu.com> | 2020-12-22 21:48:07 -0500 |
---|---|---|
committer | Hironori Shiina <Hironori.Shiina@fujitsu.com> | 2020-12-22 21:48:07 -0500 |
commit | d61887037df6b7a4449b49145cdfd7941ab2d874 (patch) | |
tree | 255e3a47a63468f618ce868b6a0b56041ec029ee /cmd | |
parent | 07663f74c48d11732a3330248f837d5abf86fe9c (diff) | |
download | podman-d61887037df6b7a4449b49145cdfd7941ab2d874.tar.gz podman-d61887037df6b7a4449b49145cdfd7941ab2d874.tar.bz2 podman-d61887037df6b7a4449b49145cdfd7941ab2d874.zip |
Fix podman build --logfile
A opened file object of a logfile gets lost because the variable
`logfile` is redefined in a `if` block. This fix stops redefining
the variable.
Signed-off-by: Hironori Shiina <Hironori.Shiina@fujitsu.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/images/build.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/podman/images/build.go b/cmd/podman/images/build.go index fbea1e3d8..3aca104e3 100644 --- a/cmd/podman/images/build.go +++ b/cmd/podman/images/build.go @@ -221,7 +221,8 @@ func build(cmd *cobra.Command, args []string) error { var logfile *os.File if cmd.Flag("logfile").Changed { - logfile, err := os.OpenFile(buildOpts.Logfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600) + var err error + logfile, err = os.OpenFile(buildOpts.Logfile, os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0600) if err != nil { return err } |