diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-01-02 10:26:34 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-01-02 10:26:44 -0500 |
commit | 9c7d5121364b25adfb35b5ac8f58bd949e0d12cb (patch) | |
tree | e1cc86d17eeac682d3cedb41ba725978663acaa4 /libpod | |
parent | 7438b7bd3afb9e5a0fc761fdc8532cd697f2187b (diff) | |
download | podman-9c7d5121364b25adfb35b5ac8f58bd949e0d12cb.tar.gz podman-9c7d5121364b25adfb35b5ac8f58bd949e0d12cb.tar.bz2 podman-9c7d5121364b25adfb35b5ac8f58bd949e0d12cb.zip |
Use sprintf to generate port numbers while committing
Casting integers to strings is definitely not correct, so let the
standard library handle matters.
Fixes #2066
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_commit.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libpod/container_commit.go b/libpod/container_commit.go index dabd224d5..026611e51 100644 --- a/libpod/container_commit.go +++ b/libpod/container_commit.go @@ -2,6 +2,7 @@ package libpod import ( "context" + "fmt" "strings" "github.com/containers/buildah" @@ -101,7 +102,7 @@ func (c *Container) Commit(ctx context.Context, destImage string, options Contai } // Expose ports for _, p := range c.config.PortMappings { - importBuilder.SetPort(string(p.ContainerPort)) + importBuilder.SetPort(fmt.Sprintf("%d", p.ContainerPort)) } // Labels for k, v := range c.Labels() { |