Skip to content

Commit

Permalink
Small fix to avoid unnecessary creation of annotations map
Browse files Browse the repository at this point in the history
Signed-off-by: diplane <diplane3d@gmail.com>
  • Loading branch information
diplane committed Mar 21, 2024
1 parent 02204fd commit 195657e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions libpod/container_inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,11 +506,13 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named

// Annotations
if ctrSpec.Annotations != nil {
if hostConfig.Annotations == nil {
hostConfig.Annotations = make(map[string]string)
}
for k, v := range ctrSpec.Annotations {
hostConfig.Annotations[k] = v
if len(ctrSpec.Annotations) != 0 {
if hostConfig.Annotations == nil {
hostConfig.Annotations = make(map[string]string)
}
for k, v := range ctrSpec.Annotations {
hostConfig.Annotations[k] = v
}
}

hostConfig.ContainerIDFile = ctrSpec.Annotations[define.InspectAnnotationCIDFile]
Expand Down

0 comments on commit 195657e

Please sign in to comment.