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

Commit c2a6aa63 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

parents bd9a9bb5 f122e6aa
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));