UserspaceEmulator: Fix bad rc check in ttyname and getcwd syscalls

Errors here are (rc < 0), not (rc < 1).
This commit is contained in:
Andreas Kling 2020-08-06 11:45:02 +02:00
parent 0d6597df2b
commit 2f1d596dd3
Notes: sideshowbarker 2024-07-19 04:13:50 +09:00

View file

@ -1271,7 +1271,7 @@ int Emulator::virt$ttyname(int fd, FlatPtr buffer, size_t buffer_size)
{
auto host_buffer = ByteBuffer::create_zeroed(buffer_size);
int rc = syscall(SC_ttyname, fd, host_buffer.data(), host_buffer.size());
if (rc < 1)
if (rc < 0)
return rc;
mmu().copy_to_vm(buffer, host_buffer.data(), host_buffer.size());
return rc;
@ -1281,7 +1281,7 @@ int Emulator::virt$getcwd(FlatPtr buffer, size_t buffer_size)
{
auto host_buffer = ByteBuffer::create_zeroed(buffer_size);
int rc = syscall(SC_getcwd, host_buffer.data(), host_buffer.size());
if (rc < 1)
if (rc < 0)
return rc;
mmu().copy_to_vm(buffer, host_buffer.data(), host_buffer.size());
return rc;