[PATCH] wpa_supplicant: allow setting scan_res_handler from within

Johannes Berg johannes at sipsolutions.net
Tue Dec 7 14:15:10 EST 2010


From: Johannes Berg <johannes.berg at intel.com>

Some new code I'm working on will need the
scan_res_handler assigned all the time in
certain circumstances, so the easiest way
is to reset it within the handler. This is
currently prevented by the way the code in
the event handler works -- change that to
permit such usage.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 wpa_supplicant/events.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 0d06f25..3c0c3d0 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -873,8 +873,13 @@ static void _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
 #endif /* CONFIG_NO_RANDOM_POOL */
 
 	if (wpa_s->scan_res_handler) {
-		wpa_s->scan_res_handler(wpa_s, scan_res);
+		void (*scan_res_handler)(struct wpa_supplicant *wpa_s,
+					 struct wpa_scan_results *scan_res);
+
+		scan_res_handler = wpa_s->scan_res_handler;
 		wpa_s->scan_res_handler = NULL;
+		scan_res_handler(wpa_s, scan_res);
+
 		wpa_scan_results_free(scan_res);
 		return;
 	}
-- 
1.7.2.3





More information about the HostAP mailing list