Do so before we put the adapter into monitor mode, so that if we can't
arrange to clean up monitor mode on exit, we don't try to put the
adapter into monitor mode.
nanosleep(&delay, NULL);
#endif
nanosleep(&delay, NULL);
#endif
+ /*
+ * If we haven't already done so, arrange to have
+ * "pcap_close_all()" called when we exit.
+ */
+ if (!pcap_do_addexit(handle)) {
+ /*
+ * "atexit()" failed; don't put the interface
+ * in rfmon mode, just give up.
+ */
+ return PCAP_ERROR_RFMON_NOTSUP;
+ }
+
/*
* Now configure the monitor interface up.
*/
/*
* Now configure the monitor interface up.
*/
*/
pcap_add_to_pcaps_to_close(handle);
*/
pcap_add_to_pcaps_to_close(handle);
- /*
- * If we haven't already done so, arrange to have
- * "pcap_close_all()" called when we exit.
- */
- if (!pcap_do_addexit(handle)) {
- /*
- * "atexit()" failed; don't put the interface
- * in rfmon mode, just give up.
- */
- return PCAP_ERROR_RFMON_NOTSUP;
- }
-
return 1;
}
#endif /* HAVE_LIBNL */
return 1;
}
#endif /* HAVE_LIBNL */