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:
parent
a28606ec1b
commit
df65e321ee
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user