sys_fs: always close locked file in sys_fs_close

Syscall returns EBUSY but succeeds nevertheless.
This commit is contained in:
Nekotekina 2020-01-16 22:10:08 +03:00
parent a005090d3d
commit e2512e78b6

View file

@ -515,24 +515,16 @@ error_code sys_fs_close(ppu_thread& ppu, u32 fd)
sys_fs.trace("sys_fs_close(fd=%d)", fd); sys_fs.trace("sys_fs_close(fd=%d)", fd);
const auto file = idm::withdraw<lv2_fs_object, lv2_file>(fd, [](lv2_file& file) -> CellError const auto file = idm::withdraw<lv2_fs_object, lv2_file>(fd);
{
if (file.lock == 1)
{
return CELL_EBUSY;
}
return {};
});
if (!file) if (!file)
{ {
return CELL_EBADF; return CELL_EBADF;
} }
if (file.ret) if (file->lock == 1)
{ {
return file.ret; return CELL_EBUSY;
} }
return CELL_OK; return CELL_OK;