From 62e8c328d85c7bfa2dc217034dbcf56d01b5d516 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Mon, 12 Aug 2019 16:34:49 -0400 Subject: Small optimization - only store exit code when nonzero JSON optimizes it out in that case anyways, so don't waste cycles doing an Itoa (and Atoi on the decode side). Signed-off-by: Matthew Heon --- libpod/events/journal_linux.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go index 72551c9ec..3bc3f6de7 100644 --- a/libpod/events/journal_linux.go +++ b/libpod/events/journal_linux.go @@ -43,7 +43,9 @@ func (e EventJournalD) Write(ee Event) error { m["PODMAN_IMAGE"] = ee.Image m["PODMAN_NAME"] = ee.Name m["PODMAN_ID"] = ee.ID - m["PODMAN_EXIT_CODE"] = strconv.Itoa(ee.ContainerExitCode) + if ee.ContainerExitCode != 0 { + m["PODMAN_EXIT_CODE"] = strconv.Itoa(ee.ContainerExitCode) + } case Volume: m["PODMAN_NAME"] = ee.Name } -- cgit v1.2.3-54-g00ecf