mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
Fix sys_tty_write() if called with pwritelen == NULL.
This commit is contained in:
parent
d4d0d35e05
commit
634c411946
1 changed files with 10 additions and 10 deletions
|
@ -23,20 +23,20 @@ error_code sys_tty_write(s32 ch, vm::cptr<char> buf, u32 len, vm::ptr<u32> pwrit
|
|||
{
|
||||
return CELL_EINVAL;
|
||||
}
|
||||
|
||||
const u32 written_len = static_cast<s32>(len) > 0 ? len : 0;
|
||||
|
||||
if (static_cast<s32>(len) <= 0)
|
||||
{
|
||||
*pwritelen = 0;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
||||
if (g_tty)
|
||||
if (written_len > 0 && g_tty)
|
||||
{
|
||||
g_tty.write(buf.get_ptr(), len);
|
||||
}
|
||||
|
||||
if (!pwritelen)
|
||||
{
|
||||
return CELL_EFAULT;
|
||||
}
|
||||
|
||||
*pwritelen = len;
|
||||
|
||||
*pwritelen = written_len;
|
||||
|
||||
return CELL_OK;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue