diff options
author | Valentin Rothberg <vrothberg@redhat.com> | 2022-03-21 15:47:01 +0100 |
---|---|---|
committer | Valentin Rothberg <vrothberg@redhat.com> | 2022-03-22 13:15:28 +0100 |
commit | 06dd9136a253521cb74497a59f2e6894806a5b6d (patch) | |
tree | d6728a4ffd1d15b5abe415b5574bfdab14eb7fea /libpod | |
parent | 6c030cd5737a6257e9b7ee2db232a24ccef294de (diff) | |
download | podman-06dd9136a253521cb74497a59f2e6894806a5b6d.tar.gz podman-06dd9136a253521cb74497a59f2e6894806a5b6d.tar.bz2 podman-06dd9136a253521cb74497a59f2e6894806a5b6d.zip |
fix a number of errcheck issues
Numerous issues remain, especially in tests/e2e.
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/boltdb_state.go | 3 | ||||
-rw-r--r-- | libpod/container_api.go | 6 | ||||
-rw-r--r-- | libpod/container_internal_linux.go | 1 | ||||
-rw-r--r-- | libpod/events/logfile.go | 5 |
4 files changed, 10 insertions, 5 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go index a826c663d..9745121c7 100644 --- a/libpod/boltdb_state.go +++ b/libpod/boltdb_state.go @@ -366,8 +366,7 @@ func (s *BoltState) GetDBConfig() (*DBConfig, error) { err = db.View(func(tx *bolt.Tx) error { configBucket, err := getRuntimeConfigBucket(tx) if err != nil { - // FIXME: this error should probably be returned - return nil // nolint: nilerr + return err } // Some of these may be nil diff --git a/libpod/container_api.go b/libpod/container_api.go index 03b3dcc04..0b6139335 100644 --- a/libpod/container_api.go +++ b/libpod/container_api.go @@ -921,7 +921,11 @@ func (c *Container) Stat(ctx context.Context, containerPath string) (*define.Fil if err != nil { return nil, err } - defer c.unmount(false) + defer func() { + if err := c.unmount(false); err != nil { + logrus.Errorf("Unmounting container %s: %v", c.ID(), err) + } + }() } info, _, _, err := c.stat(ctx, mountPoint, containerPath) diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go index de866f6b0..4d6922d73 100644 --- a/libpod/container_internal_linux.go +++ b/libpod/container_internal_linux.go @@ -2740,7 +2740,6 @@ func (c *Container) generateUserPasswdEntry(addedUID int) (string, int, int, err // If a non numeric User, then don't generate passwd uid, err := strconv.ParseUint(userspec, 10, 32) if err != nil { - // FIXME: this error should probably be returned return "", 0, 0, nil // nolint: nilerr } diff --git a/libpod/events/logfile.go b/libpod/events/logfile.go index be2aaacca..76173cde9 100644 --- a/libpod/events/logfile.go +++ b/libpod/events/logfile.go @@ -9,6 +9,7 @@ import ( "github.com/containers/podman/v4/pkg/util" "github.com/containers/storage/pkg/lockfile" "github.com/pkg/errors" + "github.com/sirupsen/logrus" ) // EventLogFile is the structure for event writing to a logfile. It contains the eventer @@ -59,7 +60,9 @@ func (e EventLogFile) Read(ctx context.Context, options ReadOptions) error { } go func() { time.Sleep(time.Until(untilTime)) - t.Stop() + if err := t.Stop(); err != nil { + logrus.Errorf("Stopping logger: %v", err) + } }() } funcDone := make(chan bool) |