Hi Patrik, On 12/18/2013 10:25 AM, Patrik Flykt wrote: > On Tue, 2013-12-03 at 13:17 +0100, Daniel Wagner wrote: >> From: Daniel Wagner <[email protected]> >> >> recv() and recvfrom() return ssize_t and not int. While we are at, >> also update all tests against the return value to use smaller, equal >> or greater operators. >> --- >> src/dnsproxy.c | 19 +++++++++++-------- >> 1 file changed, 11 insertions(+), 8 deletions(-) >> >> diff --git a/src/dnsproxy.c b/src/dnsproxy.c >> index 584640a..98fdaac 100644 >> --- a/src/dnsproxy.c >> +++ b/src/dnsproxy.c >> @@ -2050,14 +2050,14 @@ hangup: >> >> } else if (condition & G_IO_IN) { >> struct partial_reply *reply = server->incoming_reply; >> - int bytes_recv; >> + ssize_t bytes_recv; >> >> if (!reply) { >> unsigned char reply_len_buf[2]; >> uint16_t reply_len; >> >> bytes_recv = recv(sk, reply_len_buf, 2, MSG_PEEK); >> - if (!bytes_recv) { >> + if (bytes_recv == 0) { > > Why == 0 all of a sudden here and below? Aren't you after <= 0 here with > an ssize_t ?
One thing I wanted to fix is not to use the ! operator when we are comparing. The 0 byte case and the < 0 case are handled differently. cheers, daniel _______________________________________________ connman mailing list [email protected] https://lists.connman.net/mailman/listinfo/connman
