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 <danny@dcantah.dev>
This commit is contained in:
Danny Canter 2023-05-09 17:22:04 -07:00
parent a28606ec1b
commit df65e321ee

View File

@ -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