gofer: don't call hostfile.Close if hostFile is nil
PiperOrigin-RevId: 248437159 Change-Id: Ife71f6ca032fca59ec97a82961000ed0af257101
This commit is contained in:
parent
3abee2ecb9
commit
2105158d4b
|
@ -121,13 +121,17 @@ func (i *inodeOperations) Create(ctx context.Context, dir *fs.Inode, name string
|
||||||
qids, unopened, mask, p9attr, err := i.fileState.file.walkGetAttr(ctx, []string{name})
|
qids, unopened, mask, p9attr, err := i.fileState.file.walkGetAttr(ctx, []string{name})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
newFile.close(ctx)
|
newFile.close(ctx)
|
||||||
|
if hostFile != nil {
|
||||||
hostFile.Close()
|
hostFile.Close()
|
||||||
|
}
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if len(qids) != 1 {
|
if len(qids) != 1 {
|
||||||
log.Warningf("WalkGetAttr(%s) succeeded, but returned %d QIDs (%v), wanted 1", name, len(qids), qids)
|
log.Warningf("WalkGetAttr(%s) succeeded, but returned %d QIDs (%v), wanted 1", name, len(qids), qids)
|
||||||
newFile.close(ctx)
|
newFile.close(ctx)
|
||||||
|
if hostFile != nil {
|
||||||
hostFile.Close()
|
hostFile.Close()
|
||||||
|
}
|
||||||
unopened.close(ctx)
|
unopened.close(ctx)
|
||||||
return nil, syserror.EIO
|
return nil, syserror.EIO
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue