mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibCore: CIODevice::set_error() is meant to be called with the 'errno'
The point of this function is to stash away the innermost error code so that we don't lose it by the time we get back to the client code.
This commit is contained in:
parent
910fab564e
commit
7127c4fdbb
Notes:
sideshowbarker
2024-07-19 12:39:52 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/7127c4fdbb5
4 changed files with 5 additions and 5 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue