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