diff --git a/Libraries/LibCore/CIODevice.cpp b/Libraries/LibCore/CIODevice.cpp index 8c8fd57a33..0f69fb6cd6 100644 --- a/Libraries/LibCore/CIODevice.cpp +++ b/Libraries/LibCore/CIODevice.cpp @@ -126,7 +126,7 @@ ByteBuffer CIODevice::read_all() char read_buffer[4096]; int nread = ::read(m_fd, read_buffer, sizeof(read_buffer)); if (nread < 0) { - set_error(nread); + set_error(errno); return ByteBuffer::copy(data.data(), data.size()); } if (nread == 0) { @@ -196,7 +196,7 @@ bool CIODevice::close() return false; int rc = ::close(fd()); if (rc < 0) { - set_error(rc); + set_error(errno); return false; } set_fd(-1); diff --git a/Libraries/LibCore/CLocalSocket.cpp b/Libraries/LibCore/CLocalSocket.cpp index 53e13e3889..0f7ce785ed 100644 --- a/Libraries/LibCore/CLocalSocket.cpp +++ b/Libraries/LibCore/CLocalSocket.cpp @@ -15,7 +15,7 @@ CLocalSocket::CLocalSocket(CObject* parent) { int fd = socket(AF_LOCAL, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0); if (fd < 0) { - set_error(fd); + set_error(errno); } else { set_fd(fd); set_mode(CIODevice::ReadWrite); diff --git a/Libraries/LibCore/CSocket.cpp b/Libraries/LibCore/CSocket.cpp index f9bfd1b3bf..a6339bedb1 100644 --- a/Libraries/LibCore/CSocket.cpp +++ b/Libraries/LibCore/CSocket.cpp @@ -125,7 +125,7 @@ bool CSocket::send(const ByteBuffer& data) { int nsent = ::send(fd(), data.pointer(), data.size(), 0); if (nsent < 0) { - set_error(nsent); + set_error(errno); return false; } ASSERT(nsent == data.size()); diff --git a/Libraries/LibCore/CTCPSocket.cpp b/Libraries/LibCore/CTCPSocket.cpp index 4bfe37d4fe..5f5ebb79da 100644 --- a/Libraries/LibCore/CTCPSocket.cpp +++ b/Libraries/LibCore/CTCPSocket.cpp @@ -15,7 +15,7 @@ CTCPSocket::CTCPSocket(CObject* parent) { int fd = socket(AF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); if (fd < 0) { - set_error(fd); + set_error(errno); } else { set_fd(fd); set_mode(CIODevice::ReadWrite);