490-scan_wait.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. --- a/hostapd/main.c
  2. +++ b/hostapd/main.c
  3. @@ -33,6 +33,8 @@
  4. extern int wpa_debug_level;
  5. extern int wpa_debug_show_keys;
  6. extern int wpa_debug_timestamp;
  7. +static int daemonize = 0;
  8. +static char *pid_file = NULL;
  9. extern struct wpa_driver_ops *wpa_drivers[];
  10. @@ -147,6 +149,14 @@ static void hostapd_logger_cb(void *ctx,
  11. }
  12. #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  13. +static void hostapd_setup_complete_cb(void *ctx)
  14. +{
  15. + if (daemonize && os_daemonize(pid_file)) {
  16. + perror("daemon");
  17. + return;
  18. + }
  19. + daemonize = 0;
  20. +}
  21. /**
  22. * hostapd_driver_init - Preparate driver interface
  23. @@ -165,6 +175,8 @@ static int hostapd_driver_init(struct ho
  24. return -1;
  25. }
  26. + hapd->setup_complete_cb = hostapd_setup_complete_cb;
  27. +
  28. /* Initialize the driver interface */
  29. if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
  30. b = NULL;
  31. @@ -381,8 +393,6 @@ static void hostapd_global_deinit(const
  32. #endif /* CONFIG_NATIVE_WINDOWS */
  33. eap_server_unregister_methods();
  34. -
  35. - os_daemonize_terminate(pid_file);
  36. }
  37. @@ -408,11 +418,6 @@ static int hostapd_global_run(struct hap
  38. }
  39. #endif /* EAP_SERVER_TNC */
  40. - if (daemonize && os_daemonize(pid_file)) {
  41. - perror("daemon");
  42. - return -1;
  43. - }
  44. -
  45. eloop_run();
  46. return 0;
  47. @@ -521,8 +526,7 @@ int main(int argc, char *argv[])
  48. struct hapd_interfaces interfaces;
  49. int ret = 1;
  50. size_t i, j;
  51. - int c, debug = 0, daemonize = 0;
  52. - char *pid_file = NULL;
  53. + int c, debug = 0;
  54. const char *log_file = NULL;
  55. const char *entropy_file = NULL;
  56. char **bss_config = NULL, **tmp_bss;