diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-08-17 11:07:15 +0200 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-08-17 11:07:15 +0200 |
commit | 7127c4fdbb5596659aca2ec3350694341e4d8ee2 (patch) | |
tree | 5e394e30ed8b7159cc88a8caac1dd9ee8834c24d /Libraries/LibCore/CIODevice.cpp | |
parent | 910fab564e11547182660b8a04ec32178639b519 (diff) | |
download | serenity-7127c4fdbb5596659aca2ec3350694341e4d8ee2.zip |
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.
Diffstat (limited to 'Libraries/LibCore/CIODevice.cpp')
-rw-r--r-- | Libraries/LibCore/CIODevice.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
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); |