You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.7 KiB

  1. --- a/motion.c
  2. +++ b/motion.c
  3. @@ -2630,6 +2630,17 @@ int main (int argc, char **argv)
  4. struct sigaction sigchild_action;
  5. setup_signals(&sig_handler_action, &sigchild_action);
  6. + /*
  7. + * Create and a thread attribute for the threads we spawn later on.
  8. + * PTHREAD_CREATE_DETACHED means to create threads detached, i.e.
  9. + * their termination cannot be synchronized through 'pthread_join'.
  10. + */
  11. + pthread_attr_init(&thread_attr);
  12. + pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
  13. +
  14. + /* Create the TLS key for thread number. */
  15. + pthread_key_create(&tls_key_threadnr, NULL);
  16. +
  17. motion_startup(1, argc, argv);
  18. #ifdef HAVE_FFMPEG
  19. @@ -2648,17 +2659,6 @@ int main (int argc, char **argv)
  20. if (cnt_list[0]->conf.setup_mode)
  21. MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Motion running in setup mode.");
  22. - /*
  23. - * Create and a thread attribute for the threads we spawn later on.
  24. - * PTHREAD_CREATE_DETACHED means to create threads detached, i.e.
  25. - * their termination cannot be synchronized through 'pthread_join'.
  26. - */
  27. - pthread_attr_init(&thread_attr);
  28. - pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
  29. -
  30. - /* Create the TLS key for thread number. */
  31. - pthread_key_create(&tls_key_threadnr, NULL);
  32. -
  33. do {
  34. if (restart) {
  35. /*
  36. --- a/motion.h
  37. +++ b/motion.h
  38. @@ -84,7 +84,7 @@
  39. #endif
  40. /* strerror_r() XSI vs GNU */
  41. -#if (defined(BSD)) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
  42. +#if (defined(BSD)) || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE) || (!defined(__GLIBC__))
  43. #define XSI_STRERROR_R
  44. #endif