make calloc "usable" early on
closes #741 Old versions of the gnu libc uses calloc to allocate dymanic memory when some error occurs in dlsym. This results in a segfault as natives calloc wrapper has not been initialized yet. As this is a circular dependency and the libc can cope with this, we just return NULL from the calloc wrapper and hope for the best. Recent libc versions use a static buffer instead.
This commit is contained in:
parent
b2dbf3dcae
commit
86812c2abb
@ -105,6 +105,12 @@ void free(void *ptr)
|
|||||||
|
|
||||||
void *calloc(size_t nmemb, size_t size)
|
void *calloc(size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
|
/* XXX: This is a dirty hack to enable old dlsym versions to run.
|
||||||
|
* Throw it out when Ubuntu 12.04 support runs out (in 2017-04)! */
|
||||||
|
if (!real_calloc) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void *r;
|
void *r;
|
||||||
_native_syscall_enter();
|
_native_syscall_enter();
|
||||||
r = real_calloc(nmemb, size);
|
r = real_calloc(nmemb, size);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user