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
1 changed files with 3 additions and 11 deletions

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);
const auto file = idm::withdraw<lv2_fs_object, lv2_file>(fd, [](lv2_file& file) -> CellError
{
if (file.lock == 1)
{
return CELL_EBUSY;
}
return {};
});
const auto file = idm::withdraw<lv2_fs_object, lv2_file>(fd);
if (!file)
{
return CELL_EBADF;
}
if (file.ret)
if (file->lock == 1)
{
return file.ret;
return CELL_EBUSY;
}
return CELL_OK;