Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2e243e8b authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "RootCanal: Fix behaviour of Read on closed Socket" am: f122e6aa am: c2a6aa63

parents 3c53f2d1 c2a6aa63
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -67,6 +67,11 @@ PosixAsyncSocket::PosixAsyncSocket(PosixAsyncSocket&& other) {
PosixAsyncSocket::~PosixAsyncSocket() { Close(); }

ssize_t PosixAsyncSocket::Recv(uint8_t* buffer, uint64_t bufferSize) {
  if (fd_ == -1) {
    // Socket was closed locally.
    return 0;
  }

  errno = 0;
  ssize_t res = 0;
  OSI_NO_INTR(res = read(fd_, buffer, bufferSize));