]> git.sesse.net Git - vlc/blob - src/misc/linux_specific.c
Revert "Blacklist glibc 2.10-2.10.1 for 686"
[vlc] / src / misc / linux_specific.c
1 /*****************************************************************************
2  * linux_specific.c: Linux-specific initialization
3  *****************************************************************************
4  * Copyright © 2008 Rémi Denis-Courmont
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20
21 #ifdef HAVE_CONFIG_H
22 # include "config.h"
23 #endif
24
25 #include <stdio.h>
26 #include <string.h>
27
28 #include <vlc_common.h>
29 #include "../libvlc.h"
30
31 #if 0
32 #include <assert.h>
33 #include <pthread.h>
34
35 static void set_libvlc_path (void)
36 {
37     static char libvlc_path[PATH_MAX];
38
39     assert (strlen (LIBDIR) < sizeof (libvlc_path));
40     strcpy (libvlc_path, LIBDIR); /* fail safe */
41     psz_vlcpath = libvlc_path;
42
43     /* Find the path to libvlc (i.e. ourselves) */
44     FILE *maps = fopen ("/proc/self/maps", "rt");
45     if (maps == NULL)
46         return;
47
48     for (;;)
49     {
50         char buf[5000], *dir, *end;
51
52         if (fgets (buf, sizeof (buf), maps) == NULL)
53             break;
54
55         dir = strchr (buf, '/');
56         if (dir == NULL)
57             continue;
58         end = strrchr (dir, '/');
59         if (end == NULL)
60             continue;
61         if (strncmp (end + 1, "libvlc.so.", 10))
62             continue;
63
64         *end = '\0';
65         printf ("libvlc at %s\n", dir);
66         if (strlen (dir) < sizeof (libvlc_path))
67             strcpy (libvlc_path, dir);
68         break;
69     }
70
71     fclose (maps);
72 }
73 #endif
74
75 #ifdef __GLIBC__
76 # include <gnu/libc-version.h>
77 # include <stdlib.h>
78 #endif
79
80 void system_Init (libvlc_int_t *libvlc, int *argc, const char *argv[])
81 {
82 #ifdef __GLIBC__
83     const char *glcv = gnu_get_libc_version ();
84
85     /* gettext in glibc 2.5-2.7 is not thread-safe. LibVLC keeps crashing,
86      * especially in sterror_r(). Even if we have NLS disabled, the calling
87      * process might have called setlocale(). */
88     if (strverscmp (glcv, "2.5") >= 0 && strverscmp (glcv, "2.8") < 0)
89     {
90         fputs ("LibVLC has detected an unusable buggy GNU/libc version.\n"
91                "Please update to version 2.8 or newer.\n", stderr);
92         fflush (stderr);
93 #ifndef DISABLE_BUGGY_GLIBC_CHECK
94         abort ();
95 #endif
96     }
97 #endif
98
99 #if 0
100     static pthread_once_t once = PTHREAD_ONCE_INIT;
101     pthread_once (&once, set_libvlc_path);
102 #endif
103     (void)libvlc; (void)argc; (void)argv;
104 }
105
106 void system_Configure (libvlc_int_t *libvlc, int *argc, const char *argv[])
107 {
108     (void)libvlc; (void)argc; (void)argv;
109 }
110
111 void system_End (libvlc_int_t *libvlc)
112 {
113     (void)libvlc;
114 }
115