]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/glibc/glibc-rh1133810-1.patch
dhcpcd: fix delay after dhcp down.
[ipfire-2.x.git] / src / patches / glibc / glibc-rh1133810-1.patch
CommitLineData
bd76bcb8
MT
12014-08-21 Florian Weimer <fweimer@redhat.com>
2
3 [BZ #17187]
4 * iconv/gconv_trans.c (struct known_trans, search_tree, lock,
5 trans_compare, open_translit, __gconv_translit_find):
6 Remove module loading code.
7
8diff --git a/iconv/gconv_trans.c b/iconv/gconv_trans.c
9index 1e25854..d71c029 100644
10--- a/iconv/gconv_trans.c
11+++ b/iconv/gconv_trans.c
12@@ -238,181 +238,11 @@ __gconv_transliterate (struct __gconv_step *step,
13 return __GCONV_ILLEGAL_INPUT;
14 }
15
16-
17-/* Structure to represent results of found (or not) transliteration
18- modules. */
19-struct known_trans
20-{
21- /* This structure must remain the first member. */
22- struct trans_struct info;
23-
24- char *fname;
25- void *handle;
26- int open_count;
27-};
28-
29-
30-/* Tree with results of previous calls to __gconv_translit_find. */
31-static void *search_tree;
32-
33-/* We modify global data. */
34-__libc_lock_define_initialized (static, lock);
35-
36-
37-/* Compare two transliteration entries. */
38-static int
39-trans_compare (const void *p1, const void *p2)
40-{
41- const struct known_trans *s1 = (const struct known_trans *) p1;
42- const struct known_trans *s2 = (const struct known_trans *) p2;
43-
44- return strcmp (s1->info.name, s2->info.name);
45-}
46-
47-
48-/* Open (maybe reopen) the module named in the struct. Get the function
49- and data structure pointers we need. */
50-static int
51-open_translit (struct known_trans *trans)
52-{
53- __gconv_trans_query_fct queryfct;
54-
55- trans->handle = __libc_dlopen (trans->fname);
56- if (trans->handle == NULL)
57- /* Not available. */
58- return 1;
59-
60- /* Find the required symbol. */
61- queryfct = __libc_dlsym (trans->handle, "gconv_trans_context");
62- if (queryfct == NULL)
63- {
64- /* We cannot live with that. */
65- close_and_out:
66- __libc_dlclose (trans->handle);
67- trans->handle = NULL;
68- return 1;
69- }
70-
71- /* Get the context. */
72- if (queryfct (trans->info.name, &trans->info.csnames, &trans->info.ncsnames)
73- != 0)
74- goto close_and_out;
75-
76- /* Of course we also have to have the actual function. */
77- trans->info.trans_fct = __libc_dlsym (trans->handle, "gconv_trans");
78- if (trans->info.trans_fct == NULL)
79- goto close_and_out;
80-
81- /* Now the optional functions. */
82- trans->info.trans_init_fct =
83- __libc_dlsym (trans->handle, "gconv_trans_init");
84- trans->info.trans_context_fct =
85- __libc_dlsym (trans->handle, "gconv_trans_context");
86- trans->info.trans_end_fct =
87- __libc_dlsym (trans->handle, "gconv_trans_end");
88-
89- trans->open_count = 1;
90-
91- return 0;
92-}
93-
94-
95 int
96 internal_function
97 __gconv_translit_find (struct trans_struct *trans)
98 {
99- struct known_trans **found;
100- const struct path_elem *runp;
101- int res = 1;
102-
103- /* We have to have a name. */
104- assert (trans->name != NULL);
105-
106- /* Acquire the lock. */
107- __libc_lock_lock (lock);
108-
109- /* See whether we know this module already. */
110- found = __tfind (trans, &search_tree, trans_compare);
111- if (found != NULL)
112- {
113- /* Is this module available? */
114- if ((*found)->handle != NULL)
115- {
116- /* Maybe we have to reopen the file. */
117- if ((*found)->handle != (void *) -1)
118- /* The object is not unloaded. */
119- res = 0;
120- else if (open_translit (*found) == 0)
121- {
122- /* Copy the data. */
123- *trans = (*found)->info;
124- (*found)->open_count++;
125- res = 0;
126- }
127- }
128- }
129- else
130- {
131- size_t name_len = strlen (trans->name) + 1;
132- int need_so = 0;
133- struct known_trans *newp;
134-
135- /* We have to continue looking for the module. */
136- if (__gconv_path_elem == NULL)
137- __gconv_get_path ();
138-
139- /* See whether we have to append .so. */
140- if (name_len <= 4 || memcmp (&trans->name[name_len - 4], ".so", 3) != 0)
141- need_so = 1;
142-
143- /* Create a new entry. */
144- newp = (struct known_trans *) malloc (sizeof (struct known_trans)
145- + (__gconv_max_path_elem_len
146- + name_len + 3)
147- + name_len);
148- if (newp != NULL)
149- {
150- char *cp;
151-
152- /* Clear the struct. */
153- memset (newp, '\0', sizeof (struct known_trans));
154-
155- /* Store a copy of the module name. */
156- newp->info.name = cp = (char *) (newp + 1);
157- cp = __mempcpy (cp, trans->name, name_len);
158-
159- newp->fname = cp;
160-
161- /* Search in all the directories. */
162- for (runp = __gconv_path_elem; runp->name != NULL; ++runp)
163- {
164- cp = __mempcpy (__stpcpy ((char *) newp->fname, runp->name),
165- trans->name, name_len);
166- if (need_so)
167- memcpy (cp, ".so", sizeof (".so"));
168-
169- if (open_translit (newp) == 0)
170- {
171- /* We found a module. */
172- res = 0;
173- break;
174- }
175- }
176-
177- if (res)
178- newp->fname = NULL;
179-
180- /* In any case we'll add the entry to our search tree. */
181- if (__tsearch (newp, &search_tree, trans_compare) == NULL)
182- {
183- /* Yickes, this should not happen. Unload the object. */
184- res = 1;
185- /* XXX unload here. */
186- }
187- }
188- }
189-
190- __libc_lock_unlock (lock);
191-
192- return res;
193+ /* This function always fails. Transliteration module loading is
194+ not implemented. */
195+ return 1;
196 }
197--
1981.9.3
199