]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
nl80211: Fix send commands to return 0 on success
authorJouni Malinen <jouni.malinen@atheros.com>
Wed, 24 Nov 2010 12:58:58 +0000 (14:58 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 24 Nov 2010 12:58:58 +0000 (14:58 +0200)
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

index 6fca52007caf0adc08c488a30a716827c95e1a25..bab526fd9516296c6d84c9dde7b2c99f1c63cffe 100644 (file)
@@ -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;
 }