I try to write a function malloc(). My file:
void *malloc(size_t size)
{
printf("test");
}
I compile this file on shared library .so. Now, i want to use LD_PRELOAD for use my malloc function:
export LD_PRELOAD=MY_LIB
I compile my main.c with this lib:
int main()
{
malloc(5);
return (0);
}
But when I running the executable, I have a Segmentation Fault .. (same if I execute ls, cat or other command
What is the problem ? Thanks you !