From df65e321ee6724528d76ddb782dcde2917091176 Mon Sep 17 00:00:00 2001 From: Danny Canter Date: Tue, 9 May 2023 17:22:04 -0700 Subject: [PATCH] Simplify closing bundle dir fd Follow-up to #8489. We don't need to call Close in the err and success cases, we can just do it after Readdirnames returns. Signed-off-by: Danny Canter --- runtime/v2/shim_load.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runtime/v2/shim_load.go b/runtime/v2/shim_load.go index d8675b392..70313b366 100644 --- a/runtime/v2/shim_load.go +++ b/runtime/v2/shim_load.go @@ -91,13 +91,12 @@ func (m *ShimManager) loadShims(ctx context.Context) error { } bf, err := f.Readdirnames(-1) + f.Close() if err != nil { - f.Close() bundle.Delete() log.G(ctx).WithError(err).Errorf("fast path read bundle path for %s", bundle.Path) continue } - f.Close() if len(bf) == 0 { bundle.Delete() continue