Browse Source

nl80211: Fix send commands to return 0 on success

driver.h defines these functions to return 0 on success, not
number of bytes transmitted. Most callers are checking "< 0" for
error condition, but not all. Address this by following the driver
API specification on 0 meaning success.
Jouni Malinen 14 years ago
parent
commit
ebbec8b2fa
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/drivers/driver_nl80211.c

+ 7 - 1
src/drivers/driver_nl80211.c

@@ -3305,11 +3305,17 @@ static int wpa_driver_nl80211_send_frame(struct wpa_driver_nl80211_data *drv,
 		.msg_controllen = 0,
 		.msg_flags = 0,
 	};
+	int res;
 
 	if (encrypt)
 		rtap_hdr[8] |= IEEE80211_RADIOTAP_F_WEP;
 
-	return sendmsg(drv->monitor_sock, &msg, 0);
+	res = sendmsg(drv->monitor_sock, &msg, 0);
+	if (res < 0) {
+		wpa_printf(MSG_INFO, "nl80211: sendmsg: %s", strerror(errno));
+		return -1;
+	}
+	return 0;
 }