diff options
author | Matthew Heon <matthew.heon@pm.me> | 2019-08-12 16:34:49 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2019-08-12 19:05:44 -0400 |
commit | 62e8c328d85c7bfa2dc217034dbcf56d01b5d516 (patch) | |
tree | 08258bc563fc91c3f5188ec144c94434ea0d256c /libpod/events | |
parent | d3a433181d4aefb6b8d2efdd18066c7322f658a2 (diff) | |
download | podman-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>
Diffstat (limited to 'libpod/events')
-rw-r--r-- | libpod/events/journal_linux.go | 4 |
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 } |