mirror of https://github.com/RPCS3/rpcs3.git
Fix sys_tty_write() if called with pwritelen == NULL.
This commit is contained in:
parent
d4d0d35e05
commit
634c411946
|
@ -23,20 +23,20 @@ error_code sys_tty_write(s32 ch, vm::cptr<char> buf, u32 len, vm::ptr<u32> pwrit
|
||||||
{
|
{
|
||||||
return CELL_EINVAL;
|
return CELL_EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const u32 written_len = static_cast<s32>(len) > 0 ? len : 0;
|
||||||
|
|
||||||
if (static_cast<s32>(len) <= 0)
|
if (written_len > 0 && g_tty)
|
||||||
{
|
|
||||||
*pwritelen = 0;
|
|
||||||
|
|
||||||
return CELL_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_tty)
|
|
||||||
{
|
{
|
||||||
g_tty.write(buf.get_ptr(), len);
|
g_tty.write(buf.get_ptr(), len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pwritelen)
|
||||||
|
{
|
||||||
|
return CELL_EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
*pwritelen = len;
|
*pwritelen = written_len;
|
||||||
|
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue