return; /* read error!? */
}
{
- char buf[size];
+ char buf[size + 1];
addrlen = sizeof (v4);
GNUNET_break (size ==
GNUNET_NETWORK_socket_recvfrom (listen_socket4,
buf,
- size,
+ size + 1,
(struct sockaddr *) &v4,
&addrlen));
- handle_request (listen_socket4, &v4, addrlen,
- buf, size);
+ handle_request (listen_socket4,
+ &v4,
+ addrlen,
+ buf,
+ size);
}
}
* How much data is available to be read on this descriptor?
*
* @param desc socket
- * @returns #GNUNET_NO if no data is available, or on error!
+ * @returns #GNUNET_SYSERR if no data is available, or on error!
*/
ssize_t
GNUNET_NETWORK_socket_recvfrom_amount (const struct GNUNET_NETWORK_Handle *desc);
* How much data is available to be read on this descriptor?
*
* @param desc socket
- * @returns #GNUNET_NO if no data is available, or on error!
+ * @returns #GNUNET_SYSERR if no data is available, or on error!
*/
ssize_t
GNUNET_NETWORK_socket_recvfrom_amount (const struct GNUNET_NETWORK_Handle *desc)
error = ioctl (desc->fd,
FIONREAD,
&pending);
- if (error == 0)
+ if (0 == error)
return (ssize_t) pending;
- return GNUNET_NO;
+ return GNUNET_SYSERR;
#else
u_long pending;
&pending);
if (error != SOCKET_ERROR)
return (ssize_t) pending;
- return GNUNET_NO;
+ return GNUNET_SYSERR;
#endif
}