diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-11 01:22:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-11 01:22:30 +0200 |
commit | e2e8477f83f717d6a92badd317ae909cf185d04e (patch) | |
tree | 266259131bc70764b737cc65579641bd8140c533 /libpod/boltdb_state_internal.go | |
parent | df3f5afad13c91a6f2be9e83ae328483e047c13c (diff) | |
parent | e053e0e05ecd884067125627f0006d1b6e19226e (diff) | |
download | podman-e2e8477f83f717d6a92badd317ae909cf185d04e.tar.gz podman-e2e8477f83f717d6a92badd317ae909cf185d04e.tar.bz2 podman-e2e8477f83f717d6a92badd317ae909cf185d04e.zip |
Merge pull request #3521 from baude/golangcilint1
first pass of corrections for golangci-lint
Diffstat (limited to 'libpod/boltdb_state_internal.go')
-rw-r--r-- | libpod/boltdb_state_internal.go | 11 |
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) |