]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
fix netlink handling
authorJohannes Berg <johannes@sipsolutions.net>
Mon, 29 Sep 2008 14:49:06 +0000 (16:49 +0200)
committerJohannes Berg <johannes@sipsolutions.net>
Mon, 29 Sep 2008 14:49:06 +0000 (16:49 +0200)
The libnl documentation for nl_recvmsgs implies that it keeps reading
messages, but it only keeps parsing already received messages, which
in this case is a crucial difference.

iw.c

diff --git a/iw.c b/iw.c
index 28a7b393eb49c8fcb63794e3b78681cc8da1fec6..e6d7232abccb37c38cf648fcdccf14e2e9c4dbb9 100644 (file)
--- a/iw.c
+++ b/iw.c
@@ -248,11 +248,14 @@ static int handle_cmd(struct nl80211_state *state,
        if (err < 0)
                goto out;
 
+       err = 1;
+
        nl_cb_err(cb, NL_CB_CUSTOM, error_handler, &err);
        nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, finish_handler, NULL);
        nl_cb_set(cb, NL_CB_ACK, NL_CB_CUSTOM, ack_handler, &err);
 
-       nl_recvmsgs(state->nl_handle, cb);
+       while (err > 0)
+               nl_recvmsgs(state->nl_handle, cb);
  out:
        nl_cb_put(cb);
  out_free_msg: