summaryrefslogtreecommitdiff
path: root/libpod/boltdb_state_internal.go
diff options
context:
space:
mode:
authorbaude <bbaude@redhat.com>2019-07-08 13:20:17 -0500
committerbaude <bbaude@redhat.com>2019-07-10 15:52:17 -0500
commite053e0e05ecd884067125627f0006d1b6e19226e (patch)
tree9e5bcca7703a041b23c2e3c9fcfe928e8bca2962 /libpod/boltdb_state_internal.go
parent81e722d08617ee19235bf57de6d86124e6b4574a (diff)
downloadpodman-e053e0e05ecd884067125627f0006d1b6e19226e.tar.gz
podman-e053e0e05ecd884067125627f0006d1b6e19226e.tar.bz2
podman-e053e0e05ecd884067125627f0006d1b6e19226e.zip
first pass of corrections for golangci-lint
Signed-off-by: baude <bbaude@redhat.com>
Diffstat (limited to 'libpod/boltdb_state_internal.go')
-rw-r--r--libpod/boltdb_state_internal.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go
index ee2784cdd..408ef7224 100644
--- a/libpod/boltdb_state_internal.go
+++ b/libpod/boltdb_state_internal.go
@@ -247,6 +247,15 @@ func (s *BoltState) getDBCon() (*bolt.DB, error) {
return db, nil
}
+// deferredCloseDBCon closes the bolt db but instead of returning an
+// error it logs the error. it is meant to be used within the confines
+// of a defer statement only
+func (s *BoltState) deferredCloseDBCon(db *bolt.DB) {
+ if err := s.closeDBCon(db); err != nil {
+ logrus.Errorf("failed to close libpod db: %q", err)
+ }
+}
+
// Close a connection to the database.
// MUST be used in place of `db.Close()` to ensure proper unlocking of the
// state.
@@ -479,7 +488,7 @@ func (s *BoltState) addContainer(ctr *Container, pod *Pod) error {
if err != nil {
return err
}
- defer s.closeDBCon(db)
+ defer s.deferredCloseDBCon(db)
err = db.Update(func(tx *bolt.Tx) error {
idsBucket, err := getIDBucket(tx)