450-scan_wait.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. --- a/hostapd/main.c
  2. +++ b/hostapd/main.c
  3. @@ -37,6 +37,8 @@ struct hapd_global {
  4. };
  5. static struct hapd_global global;
  6. +static int daemonize = 0;
  7. +static char *pid_file = NULL;
  8. #ifndef CONFIG_NO_HOSTAPD_LOGGER
  9. @@ -143,6 +145,14 @@ static void hostapd_logger_cb(void *ctx,
  10. }
  11. #endif /* CONFIG_NO_HOSTAPD_LOGGER */
  12. +static void hostapd_setup_complete_cb(void *ctx)
  13. +{
  14. + if (daemonize && os_daemonize(pid_file)) {
  15. + perror("daemon");
  16. + return;
  17. + }
  18. + daemonize = 0;
  19. +}
  20. /**
  21. * hostapd_driver_init - Preparate driver interface
  22. @@ -161,6 +171,8 @@ static int hostapd_driver_init(struct ho
  23. return -1;
  24. }
  25. + hapd->setup_complete_cb = hostapd_setup_complete_cb;
  26. +
  27. /* Initialize the driver interface */
  28. if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
  29. b = NULL;
  30. @@ -401,8 +413,6 @@ static void hostapd_global_deinit(const
  31. #endif /* CONFIG_NATIVE_WINDOWS */
  32. eap_server_unregister_methods();
  33. -
  34. - os_daemonize_terminate(pid_file);
  35. }
  36. @@ -428,18 +438,6 @@ static int hostapd_global_run(struct hap
  37. }
  38. #endif /* EAP_SERVER_TNC */
  39. - if (daemonize) {
  40. - if (os_daemonize(pid_file)) {
  41. - wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
  42. - return -1;
  43. - }
  44. - if (eloop_sock_requeue()) {
  45. - wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
  46. - strerror(errno));
  47. - return -1;
  48. - }
  49. - }
  50. -
  51. eloop_run();
  52. return 0;
  53. @@ -638,8 +636,7 @@ int main(int argc, char *argv[])
  54. struct hapd_interfaces interfaces;
  55. int ret = 1;
  56. size_t i, j;
  57. - int c, debug = 0, daemonize = 0;
  58. - char *pid_file = NULL;
  59. + int c, debug = 0;
  60. const char *log_file = NULL;
  61. const char *entropy_file = NULL;
  62. char **bss_config = NULL, **tmp_bss;