Uploaded image for project: 'Qpid Proton'
  1. Qpid Proton
  2. PROTON-1165

qpid proton cpp binding posix/io.cpp tests wrong error condition

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • proton-0.12.0
    • proton-0.14.0
    • cpp-binding
    • linux/posix

    Description

      posix/io.cpp:

      size_t socket_engine::io_write(const char *buf, size_t size) {
      ssize_t n = ::write(socket_, buf, size);
      if (n == EAGAIN || n == EWOULDBLOCK) return 0;
      if (n < 0) check(n, "write: ");
      return n;
      }

      instead of testing n against EAGAIN/EWOULDBLOCK, n needs to be tested against -1 and then errno needs to be compared to EAGAIN/EWOULDBLOCK

      proposed fix:

      size_t socket_engine::io_write(const char *buf, size_t size) {
      ssize_t n = ::write(socket_, buf, size);

      if (n < 0) {
      if (errno == EAGAIN || errno == EWOULDBLOCK)

      { return 0; }

      check(n, "write: ");
      }
      return n;
      }

      Attachments

        Activity

          People

            aconway Alan Conway
            skipper600 Roman Puls
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: