Merge pull request #8504 from dcantah/close-f-early

Simplify closing bundle dir fd
This commit is contained in:
Fu Wei 2023-05-10 10:09:01 +08:00 committed by GitHub
commit bd185813ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,13 +91,12 @@ func (m *ShimManager) loadShims(ctx context.Context) error {
} }
bf, err := f.Readdirnames(-1) bf, err := f.Readdirnames(-1)
f.Close()
if err != nil { if err != nil {
f.Close()
bundle.Delete() bundle.Delete()
log.G(ctx).WithError(err).Errorf("fast path read bundle path for %s", bundle.Path) log.G(ctx).WithError(err).Errorf("fast path read bundle path for %s", bundle.Path)
continue continue
} }
f.Close()
if len(bf) == 0 { if len(bf) == 0 {
bundle.Delete() bundle.Delete()
continue continue