diff mbox

[1/1] STA: Fix nl_recvmsgs error print

Message ID 0cd413239bd65e5d5cc1e855fa15dcd9871b91dd.1400753034.git.jithu@broadcom.com
State Changes Requested
Headers show

Commit Message

Jithu Jance May 22, 2014, 10:04 a.m. UTC
Print error only on negative return values.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
---
 src/drivers/driver_nl80211.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
1.7.9.5

Comments

Jouni Malinen May 22, 2014, 1:37 p.m. UTC | #1
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.
diff mbox

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 709e13a..10a639c 100644
--- 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);