]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/glibc/glibc-rh989558.patch
Merge branch 'master' into fifteen
[people/teissler/ipfire-2.x.git] / src / patches / glibc / glibc-rh989558.patch
1 #
2 # Red Hat BZ:
3 # https://bugzilla.redhat.com/show_bug.cgi?id=816647
4 #
5 # ChangeLog
6 #
7 #2013-04-30 Patsy Franklin <pfrankli@redhat.com>
8 #
9 # * iconv/gconv_cache.c (find_module): Demangle init_fct before
10 # checking for NULL. Mangle __btowc_fct if init_fct is non-NULL.
11 # * iconv/gconv_db.c (free_derivation): Check that __shlib_handle
12 # is non-NULL before demangling the end_fct. Check for NULL
13 # end_fct after demangling.
14 # (__gconv_release_step): Demangle the end_fct before checking
15 # it for NULL. Remove assert on __shlibc_handle != NULL.
16 # (gen_steps): Don't check btowc_fct for NULL before mangling.
17 # Demangle init_fct before checking for NULL.
18 # (increment_counter): Likewise
19 # * gconv_dl.c (__gconv_find_shlib): Don't check init_fct or
20 # end_fct for NULL before mangling.
21 # * wcsmbs/btowc.c (__btowc): Demangle btowc_fct before checking
22 # for NULL.
23 #
24 diff -Nrup a/iconv/gconv_cache.c b/iconv/gconv_cache.c
25 --- a/iconv/gconv_cache.c 2012-12-24 22:02:13.000000000 -0500
26 +++ b/iconv/gconv_cache.c 2013-04-30 11:34:20.112389987 -0400
27 @@ -207,17 +207,16 @@ find_module (const char *directory, cons
28 result->__data = NULL;
29
30 /* Call the init function. */
31 - if (result->__init_fct != NULL)
32 - {
33 - __gconv_init_fct init_fct = result->__init_fct;
34 + __gconv_init_fct init_fct = result->__init_fct;
35 #ifdef PTR_DEMANGLE
36 - PTR_DEMANGLE (init_fct);
37 + PTR_DEMANGLE (init_fct);
38 #endif
39 + if (init_fct != NULL)
40 + {
41 status = DL_CALL_FCT (init_fct, (result));
42
43 #ifdef PTR_MANGLE
44 - if (result->__btowc_fct != NULL)
45 - PTR_MANGLE (result->__btowc_fct);
46 + PTR_MANGLE (result->__btowc_fct);
47 #endif
48 }
49 }
50 diff -Nrup a/iconv/gconv_db.c b/iconv/gconv_db.c
51 --- a/iconv/gconv_db.c 2012-12-24 22:02:13.000000000 -0500
52 +++ b/iconv/gconv_db.c 2013-04-30 11:32:42.700592914 -0400
53 @@ -179,16 +179,15 @@ free_derivation (void *p)
54 size_t cnt;
55
56 for (cnt = 0; cnt < deriv->nsteps; ++cnt)
57 - if (deriv->steps[cnt].__counter > 0
58 - && deriv->steps[cnt].__end_fct != NULL)
59 + if ((deriv->steps[cnt].__counter > 0)
60 + && (deriv->steps[cnt].__shlib_handle != NULL))
61 {
62 - assert (deriv->steps[cnt].__shlib_handle != NULL);
63 -
64 __gconv_end_fct end_fct = deriv->steps[cnt].__end_fct;
65 #ifdef PTR_DEMANGLE
66 PTR_DEMANGLE (end_fct);
67 #endif
68 - DL_CALL_FCT (end_fct, (&deriv->steps[cnt]));
69 + if (end_fct != NULL)
70 + DL_CALL_FCT (end_fct, (&deriv->steps[cnt]));
71 }
72
73 /* Free the name strings. */
74 @@ -212,16 +211,12 @@ __gconv_release_step (struct __gconv_ste
75 if (step->__shlib_handle != NULL && --step->__counter == 0)
76 {
77 /* Call the destructor. */
78 - if (step->__end_fct != NULL)
79 - {
80 - assert (step->__shlib_handle != NULL);
81 -
82 - __gconv_end_fct end_fct = step->__end_fct;
83 + __gconv_end_fct end_fct = step->__end_fct;
84 #ifdef PTR_DEMANGLE
85 - PTR_DEMANGLE (end_fct);
86 + PTR_DEMANGLE (end_fct);
87 #endif
88 - DL_CALL_FCT (end_fct, (step));
89 - }
90 + if (end_fct != NULL)
91 + DL_CALL_FCT (end_fct, (step));
92
93 #ifndef STATIC_GCONV
94 /* Release the loaded module. */
95 @@ -293,13 +288,11 @@ gen_steps (struct derivation_step *best,
96
97 /* Call the init function. */
98 __gconv_init_fct init_fct = result[step_cnt].__init_fct;
99 - if (init_fct != NULL)
100 - {
101 - assert (result[step_cnt].__shlib_handle != NULL);
102 -
103 # ifdef PTR_DEMANGLE
104 - PTR_DEMANGLE (init_fct);
105 + PTR_DEMANGLE (init_fct);
106 # endif
107 + if (init_fct != NULL)
108 + {
109 status = DL_CALL_FCT (init_fct, (&result[step_cnt]));
110
111 if (__builtin_expect (status, __GCONV_OK) != __GCONV_OK)
112 @@ -312,8 +305,7 @@ gen_steps (struct derivation_step *best,
113 }
114
115 # ifdef PTR_MANGLE
116 - if (result[step_cnt].__btowc_fct != NULL)
117 - PTR_MANGLE (result[step_cnt].__btowc_fct);
118 + PTR_MANGLE (result[step_cnt].__btowc_fct);
119 # endif
120 }
121 }
122 @@ -393,16 +385,15 @@ increment_counter (struct __gconv_step *
123
124 /* Call the init function. */
125 __gconv_init_fct init_fct = step->__init_fct;
126 - if (init_fct != NULL)
127 - {
128 #ifdef PTR_DEMANGLE
129 - PTR_DEMANGLE (init_fct);
130 + PTR_DEMANGLE (init_fct);
131 #endif
132 + if (init_fct != NULL)
133 + {
134 DL_CALL_FCT (init_fct, (step));
135
136 #ifdef PTR_MANGLE
137 - if (step->__btowc_fct != NULL)
138 - PTR_MANGLE (step->__btowc_fct);
139 + PTR_MANGLE (step->__btowc_fct);
140 #endif
141 }
142 }
143 diff -Nrup a/iconv/gconv_dl.c b/iconv/gconv_dl.c
144 --- a/iconv/gconv_dl.c 2012-12-24 22:02:13.000000000 -0500
145 +++ b/iconv/gconv_dl.c 2013-04-30 11:32:42.701592922 -0400
146 @@ -132,10 +132,8 @@ __gconv_find_shlib (const char *name)
147
148 #ifdef PTR_MANGLE
149 PTR_MANGLE (found->fct);
150 - if (found->init_fct != NULL)
151 - PTR_MANGLE (found->init_fct);
152 - if (found->end_fct != NULL)
153 - PTR_MANGLE (found->end_fct);
154 + PTR_MANGLE (found->init_fct);
155 + PTR_MANGLE (found->end_fct);
156 #endif
157
158 /* We have succeeded in loading the shared object. */
159 diff -Nrup a/wcsmbs/btowc.c b/wcsmbs/btowc.c
160 --- a/wcsmbs/btowc.c 2012-12-24 22:02:13.000000000 -0500
161 +++ b/wcsmbs/btowc.c 2013-04-30 11:32:42.701592922 -0400
162 @@ -47,15 +47,15 @@ __btowc (c)
163 /* Get the conversion functions. */
164 fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE));
165 __gconv_btowc_fct btowc_fct = fcts->towc->__btowc_fct;
166 +#ifdef PTR_DEMANGLE
167 + if (fcts->towc->__shlib_handle != NULL)
168 + PTR_DEMANGLE (btowc_fct);
169 +#endif
170
171 if (__builtin_expect (fcts->towc_nsteps == 1, 1)
172 && __builtin_expect (btowc_fct != NULL, 1))
173 {
174 /* Use the shortcut function. */
175 -#ifdef PTR_DEMANGLE
176 - if (fcts->towc->__shlib_handle != NULL)
177 - PTR_DEMANGLE (btowc_fct);
178 -#endif
179 return DL_CALL_FCT (btowc_fct, (fcts->towc, (unsigned char) c));
180 }
181 else