summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-08-12 16:34:49 -0400
committerMatthew Heon <matthew.heon@pm.me>2019-08-12 19:05:44 -0400
commit62e8c328d85c7bfa2dc217034dbcf56d01b5d516 (patch)
tree08258bc563fc91c3f5188ec144c94434ea0d256c
parentd3a433181d4aefb6b8d2efdd18066c7322f658a2 (diff)
downloadpodman-62e8c328d85c7bfa2dc217034dbcf56d01b5d516.tar.gz
podman-62e8c328d85c7bfa2dc217034dbcf56d01b5d516.tar.bz2
podman-62e8c328d85c7bfa2dc217034dbcf56d01b5d516.zip
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 <matthew.heon@pm.me>
-rw-r--r--libpod/events/journal_linux.go4
1 files changed, 3 insertions, 1 deletions
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
}