summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2019-08-12 16:34:49 -0400
committerMatthew Heon <mheon@redhat.com>2019-08-27 15:45:51 -0400
commitbbb1ba78d4da3df796b845c67ff477e7cd8563dc (patch)
tree28c790520e074bb77463940e733a999769c05b2b /libpod
parent3849d8cbfb4031d2625b015fa421d4f44f23a6b4 (diff)
downloadpodman-bbb1ba78d4da3df796b845c67ff477e7cd8563dc.tar.gz
podman-bbb1ba78d4da3df796b845c67ff477e7cd8563dc.tar.bz2
podman-bbb1ba78d4da3df796b845c67ff477e7cd8563dc.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')
-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 94fceccb1..2854e6548 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
}