1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Fix getting tunable values on big-endian (BZ #21109)

The code to set value passed a tunable_val_t, which when cast to
int32_t on big-endian gives the wrong value.  Instead, use
tunable_val_t.numval instead, which can then be safely cast into
int32_t.
This commit is contained in:
Siddhesh Poyarekar
2017-02-08 11:18:23 +05:30
parent 3f67d1a702
commit 8cbc826c37
4 changed files with 18 additions and 6 deletions

View File

@ -212,9 +212,9 @@ __malloc_fork_unlock_child (void)
#if HAVE_TUNABLES
static inline int do_set_mallopt_check (int32_t value);
void
DL_TUNABLE_CALLBACK (set_mallopt_check) (void *valp)
DL_TUNABLE_CALLBACK (set_mallopt_check) (tunable_val_t *valp)
{
int32_t value = *(int32_t *) valp;
int32_t value = (int32_t) valp->numval;
do_set_mallopt_check (value);
if (check_action != 0)
__malloc_check_init ();
@ -223,9 +223,9 @@ DL_TUNABLE_CALLBACK (set_mallopt_check) (void *valp)
# define DL_TUNABLE_CALLBACK_FNDECL(__name, __type) \
static inline int do_ ## __name (__type value); \
void \
DL_TUNABLE_CALLBACK (__name) (void *valp) \
DL_TUNABLE_CALLBACK (__name) (tunable_val_t *valp) \
{ \
__type value = *(__type *) valp; \
__type value = (__type) (valp)->numval; \
do_ ## __name (value); \
}