]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
mac80211_linux: Fix libnl error string fetching
authorJouni Malinen <j@w1.fi>
Thu, 2 Jan 2020 14:50:50 +0000 (16:50 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 2 Jan 2020 16:05:38 +0000 (18:05 +0200)
libnl functions return a library specific error value. errno is not
necessarily valid in all error cases and strerror() for the returned
value is not valid either.

Use nl_geterror() to get the correct error string from the returned
error code.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/drivers/driver_macsec_linux.c

index 9c2aa3c702cd8e9bec63f369b84b8922b656a9e0..5319ba2d0b8c058e8c7bfca6ba29bffcefda706b 100644 (file)
@@ -319,14 +319,14 @@ static int macsec_drv_macsec_init(void *priv, struct macsec_init_params *params)
        if (err < 0) {
                wpa_printf(MSG_ERROR, DRV_PREFIX
                           "Unable to connect NETLINK_ROUTE socket: %s",
-                          strerror(errno));
+                          nl_geterror(err));
                goto sock;
        }
 
        err = rtnl_link_alloc_cache(drv->sk, AF_UNSPEC, &drv->link_cache);
        if (err < 0) {
                wpa_printf(MSG_ERROR, DRV_PREFIX "Unable to get link cache: %s",
-                          strerror(errno));
+                          nl_geterror(err));
                goto sock;
        }