[PATCH 1/1] STA: Fix nl_recvmsgs error print

Jouni Malinen j at w1.fi
Thu May 22 09:37:36 EDT 2014


On Thu, May 22, 2014 at 03:34:57PM +0530, Jithu Jance wrote:
> Print error only on negative return values.

> diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
> @@ -652,7 +652,7 @@ static int send_and_recv(struct nl80211_global *global,
> 
>  	while (err > 0) {
>  		int res = nl_recvmsgs(nl_handle, cb);
> -		if (res) {
> +		if (res < 0) {
>  			wpa_printf(MSG_INFO,
>  				   "nl80211: %s->nl_recvmsgs failed: %d",
>  				   __func__, res);

Could you please clarify when nl_recvmsgs() can return > 0? It is
documented with "return 0 on success or a negative error code from
nl_recv()" and the implementation in libnl is clearly not going to be
able to return > 0..

And if it were possible to get > 0 from here, the other nl_recvmsgs()
calls in driver_nl80211.c should also be modified to remain consistent.
 
-- 
Jouni Malinen                                            PGP id EFC895FA


More information about the HostAP mailing list