From: Johannes Berg Date: Mon, 29 Sep 2008 14:49:06 +0000 (+0200) Subject: fix netlink handling X-Git-Tag: v0.9.10~30 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c758fb28d1f82d9e96dc7ec6d8dd843a5ac9f504;p=thirdparty%2Fiw.git fix netlink handling 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. --- diff --git a/iw.c b/iw.c index 28a7b39..e6d7232 100644 --- 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: