Explorar o código

UserspaceEmulator: Fix bogus use of "errno" in shbuf related syscalls

When we're making direct syscalls, there's no "errno" involved.
Thanks to Sergey for spotting these.
Andreas Kling %!s(int64=5) %!d(string=hai) anos
pai
achega
1873b8f3e4
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      DevTools/UserspaceEmulator/Emulator.cpp

+ 2 - 2
DevTools/UserspaceEmulator/Emulator.cpp

@@ -308,7 +308,7 @@ int Emulator::virt$shbuf_create(int size, FlatPtr buffer)
     u8* host_data = nullptr;
     int shbuf_id = syscall(SC_shbuf_create, size, &host_data);
     if (shbuf_id < 0)
-        return -errno;
+        return shbuf_id;
     FlatPtr address = allocate_vm(size, PAGE_SIZE);
     auto region = SharedBufferRegion::create_with_shbuf_id(address, size, shbuf_id, host_data);
     m_mmu.add_region(move(region));
@@ -321,7 +321,7 @@ FlatPtr Emulator::virt$shbuf_get(int shbuf_id, FlatPtr size_ptr)
     size_t host_size = 0;
     void* host_data = (void*)syscall(SC_shbuf_get, shbuf_id, &host_size);
     if (host_data == (void*)-1)
-        return -errno;
+        return (FlatPtr)host_data;
     FlatPtr address = allocate_vm(host_size, PAGE_SIZE);
     auto region = SharedBufferRegion::create_with_shbuf_id(address, host_size, shbuf_id, (u8*)host_data);
     m_mmu.add_region(move(region));