From ebbec8b2facab43634ed3b03f6bb48adcede410e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 24 Nov 2010 14:58:58 +0200 Subject: [PATCH] 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. --- src/drivers/driver_nl80211.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 6fca52007..bab526fd9 100644 --- a/src/drivers/driver_nl80211.c +++ b/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; }