From 565bb564546e6cbcb923d49f145b2e851672216c Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Thu, 23 Feb 2023 11:30:46 +0100 Subject: [PATCH] sqlite: AddContainerExitCode: allow to replace Allow to replace existing exit codes. A container may be started and stopped multiple times etc. Signed-off-by: Valentin Rothberg --- libpod/sqlite_state.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libpod/sqlite_state.go b/libpod/sqlite_state.go index add06dd926..f525411122 100644 --- a/libpod/sqlite_state.go +++ b/libpod/sqlite_state.go @@ -855,7 +855,7 @@ func (s *SQLiteState) AddContainerExitCode(id string, exitCode int32) (defErr er } }() - if _, err := tx.Exec("INSERT INTO ContainerExitCode VALUES (?, ?, ?);", id, time.Now().Unix(), exitCode); err != nil { + if _, err := tx.Exec("INSERT OR REPLACE INTO ContainerExitCode VALUES (?, ?, ?);", id, time.Now().Unix(), exitCode); err != nil { return fmt.Errorf("adding container %s exit code %d: %w", id, exitCode, err) }