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

Commit f122e6aa authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "RootCanal: Fix behaviour of Read on closed Socket"

parents dd77f3a7 35e1c55a
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));