You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2016/07/19 16:46:21 UTC

[jira] [Commented] (PROTON-1165) qpid proton cpp binding posix/io.cpp tests wrong error condition

    [ https://issues.apache.org/jira/browse/PROTON-1165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15384477#comment-15384477 ] 

ASF subversion and git services commented on PROTON-1165:
---------------------------------------------------------

Commit d8412be3691220c5b393a8b8c095dc450f36324c in qpid-proton's branch refs/heads/master from [~aconway]
[ https://git-wip-us.apache.org/repos/asf?p=qpid-proton.git;h=d8412be ]

PROTON-1165: examples/cpp/mt/epoll_container testing wrong error value

The code was incorrectly testing the return value of read()/write() against
EINTR instead of errno.


> qpid proton cpp binding posix/io.cpp tests wrong error condition
> ----------------------------------------------------------------
>
>                 Key: PROTON-1165
>                 URL: https://issues.apache.org/jira/browse/PROTON-1165
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: cpp-binding
>    Affects Versions: 0.12.0
>         Environment: linux/posix
>            Reporter: Roman Puls
>            Assignee: Alan Conway
>              Labels: patch
>             Fix For: 0.14.0
>
>
> 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;
> }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org